From patchwork Sat Sep 5 20:41:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 254820 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3F00C43461 for ; Sat, 5 Sep 2020 20:44:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72C8E20796 for ; Sat, 5 Sep 2020 20:44:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KIZ0ost6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728935AbgIEUoE (ORCPT ); Sat, 5 Sep 2020 16:44:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728771AbgIEUmu (ORCPT ); Sat, 5 Sep 2020 16:42:50 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 290B5C061258; Sat, 5 Sep 2020 13:42:49 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id y4so11783612ljk.8; Sat, 05 Sep 2020 13:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SVIZolRkigMG5KeyY60o0qplGOEf+YGse9lnTNFQTF8=; b=KIZ0ost64cHgPw+51EqE+n9nLPp6Damip2giJDJtSVL+rn4I4JJV2FNk1TpE93KYbW 9J70UEgw7GR3wXyg2fxqLmQkSHHElh3nrKwZRuS0uoIW787EUP2QvzBUBySLjpAepC1x l0GsgIM0P0sGYgKuAZHSs9vaGZ3z78AEJnnK714qVmUoqMritALAbmLk51gZTm1v0zoI RflZgt8BESf9H8pCfBHd7c6rt4ol1rvmX6JTFzXfsbDKYZdyPllVPQl8N+hS/tyEcGdC xjMa8L5wr/p+ftFOJEKI8dpxCYN+CfDTrPued0uF+DHA/IxdAwtLvEg9APKuGmcv17wp iXYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SVIZolRkigMG5KeyY60o0qplGOEf+YGse9lnTNFQTF8=; b=mg7D6FNaQfY0ki+1pwFPROGpiryFCTfHK87+ORl/Lp3Sdkg6+c5IyevnLJrd5tr/gO /Mn1C5K8+aj2fCwc+ZTnGsYkBncn9vbT6GkKBrbfurhOtJD/LXE2jusGFI4xVEYUAeZD ScC3AqyrOi7qNc06RiClwiVs9Md8Ki4F/F65OorqpGp14vxJLMtT3L3aOnugSZ6rUija V4VUt0P8vuSbLwuzlrJPrQ4/p/bl3AiQgCy9F5hOl3Hx++bnbBGOKv3jjM7qgiJ53Z1v hQTLcT0TYacmxap7+QPsYy84PVvHOzQ9x85bjPf3Rb51gTTkMVVQCN3E99c79oZoahtQ Ktuw== X-Gm-Message-State: AOAM530ozE+XBethp8LmVYrU04zLKbzgAhLtKXGW+fvMmwvKa5UKKBkT BAsD9r994b10ydLAiXIY+iE= X-Google-Smtp-Source: ABdhPJz4mB6yn7gy1KC9/kUrOaH5rUaQwGCC4JaWDd85sZ/UZUJpXci8/OOJ1HWK1AaehpH2XCeaZw== X-Received: by 2002:a2e:9c9:: with SMTP id 192mr6350314ljj.197.1599338567640; Sat, 05 Sep 2020 13:42:47 -0700 (PDT) Received: from localhost.localdomain (109-252-170-211.dynamic.spd-mgts.ru. [109.252.170.211]) by smtp.gmail.com with ESMTPSA id e17sm1677763ljn.18.2020.09.05.13.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 13:42:46 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Wolfram Sang , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andy Shevchenko Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 25/31] i2c: tegra: Check errors for both positive and negative values Date: Sat, 5 Sep 2020 23:41:45 +0300 Message-Id: <20200905204151.25343-26-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200905204151.25343-1-digetx@gmail.com> References: <20200905204151.25343-1-digetx@gmail.com> MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The driver's code is inconsistent in regards to the error values checking. The correct way should be to check both positive and negative values. This patch cleans up the error-checks in the code. Note that the pm_runtime_get_sync() could return positive value on success, hence only relevant parts of the code are changed by this patch. Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 9b4107b07135..64776cd8e0ff 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -969,7 +969,7 @@ static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev, slv_config.device_fc = true; ret = dmaengine_slave_config(chan, &slv_config); - if (ret < 0) { + if (ret) { dev_err(i2c_dev->dev, "DMA slave config failed: %d\n", ret); dev_err(i2c_dev->dev, "falling back to PIO\n"); @@ -1208,7 +1208,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, xfer_size, DMA_FROM_DEVICE); err = tegra_i2c_dma_submit(i2c_dev, xfer_size); - if (err < 0) { + if (err) { dev_err(i2c_dev->dev, "starting RX DMA failed, err %d\n", err); @@ -1233,7 +1233,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, xfer_size, DMA_TO_DEVICE); err = tegra_i2c_dma_submit(i2c_dev, xfer_size); - if (err < 0) { + if (err) { dev_err(i2c_dev->dev, "starting TX DMA failed, err %d\n", err);