From patchwork Tue Sep 8 22:39:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 254758 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.6 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, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 050A5C43461 for ; Tue, 8 Sep 2020 22:43:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEFFC20757 for ; Tue, 8 Sep 2020 22:43:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HHLAh3c4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730373AbgIHWmz (ORCPT ); Tue, 8 Sep 2020 18:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730115AbgIHWlI (ORCPT ); Tue, 8 Sep 2020 18:41:08 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A22BC06179E; Tue, 8 Sep 2020 15:40:58 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id a15so1003494ljk.2; Tue, 08 Sep 2020 15:40:58 -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=t5B6ysa7LjN/iHtlHoBH00Loul7JOotcYLDG2pE2B3U=; b=HHLAh3c4kVDtHud7bBCoc46guztvJ3zdyscQeEZy+Gf6FSRbdxhgpSjkQoDV7pt1Xu NaqYHUXS82yPuFmwVBXKY+02cDxE67TmDSsxYYk0pQtR2L1I6gzhtFOdtdYt45aw+y+B RZLg6hFJQaKLELyVxmxVMCics2Wz3HbBIdX+usPTujyCAmuwNQetPCkZN3WSxll0XdYk /g5RUvKifbWnKAl8U7xhBbfzmDasDCzLVAT490Cphyir3v09nnUOa1IXrEBUj47Jsl8q l571jX1WqerxXHCB1krrGL/bKbdnK9mYGjI+AedoSzTpc+tUA7ihKlArtVlpZgY/ugJe JsTQ== 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=t5B6ysa7LjN/iHtlHoBH00Loul7JOotcYLDG2pE2B3U=; b=UkJmExcsHq6lpiCtO2DXH4U72/G550s1ukYKfJEQ12ENfrdeP4nISvVpv61QeSU2q8 dfTGIQV66xI6KTPeqq7rt76yvXOG/xdRViVggNlCAnJjzMMwQ0YLx82+Azz+qJLbxuls u7cl1YfaGZyZIcKae0FfLSCbSEMvmTg14grA9mAUGM5kOZE3z3/Jc03cO4QmthuCbhCF 2zMsZuPkRAwG+cqAi99CXKTemqJl868VQi7LjEmGVv5ZdIoveOAlhFoZ7Rw7VxLWDLf/ LVch2thX9ZjqOpYP7vtQdt/jb/NnMp5KOpzS2On1hTf3KKxP+zBfwohQI0P8qzRG6svD F2vw== X-Gm-Message-State: AOAM532XM7krRpqZbTyFQzO1hVD6+vFU4vmTBBXvK49GjRTY5vmxZLIB bSGYl7AmCaBHkMpcFyH1h13M4PnN34M= X-Google-Smtp-Source: ABdhPJw+agA+k4JlD3PPK/iBNjFyQOinKeXX6tv4eYz6XiCqt6dFSa77U58OrOl28+AiefObVIv9yw== X-Received: by 2002:a2e:8681:: with SMTP id l1mr341010lji.108.1599604857092; Tue, 08 Sep 2020 15:40:57 -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 s15sm268311ljp.25.2020.09.08.15.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 15:40:56 -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 v7 27/34] i2c: tegra: Check errors for both positive and negative values Date: Wed, 9 Sep 2020 01:39:59 +0300 Message-Id: <20200908224006.25636-28-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908224006.25636-1-digetx@gmail.com> References: <20200908224006.25636-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. Reviewed-by: Michał Mirosław Signed-off-by: Dmitry Osipenko Tested-by: Thierry Reding --- 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 2f39366b6d55..fe672cfebe12 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -981,7 +981,7 @@ static int tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev, size_t len) 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); return ret; @@ -1224,7 +1224,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); @@ -1249,7 +1249,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);