From patchwork Tue Sep 8 02:10:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 254784 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 198D9C43461 for ; Tue, 8 Sep 2020 02:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DE2A0215A4 for ; Tue, 8 Sep 2020 02:14:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rtm0v+gA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728392AbgIHCO3 (ORCPT ); Mon, 7 Sep 2020 22:14:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728384AbgIHCMP (ORCPT ); Mon, 7 Sep 2020 22:12:15 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A756C0617A5; Mon, 7 Sep 2020 19:12:03 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id y4so18007832ljk.8; Mon, 07 Sep 2020 19:12:03 -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=bhYXVU5OxtMkVW3XxSZWr/Wz0AEa7WBnTGkvmLBOr6I=; b=rtm0v+gAdEnm932au1tB3Fambj6CK2mvDSkO41G+MXRYrgKpvgZQbe+qo2qQsXM9pa kWpRKCslYyWfiIdlxpDEwCLwtCaXCN3NPtcbh3Nk/SzzuhxMuBq/FvNvkAlTUQULVEu0 PIoSJIZUEEIAkavsKZoYTi6NVYSTluxri29OUE87N7ZFXDZUp8LkNNDMJXLWFblzK1Pa Tf7lgqHPdsXOGJPY8qiwKJtX80U3lk6h/dj/iCbg2XpjUYXa4dKXGOxthGNGQrptVID3 BZJO+kccC3lJd9ORL77C18iESLpBktXup3j0OOU7ffbAe2U3TeAycgnoiJwNS90CVv+W JyTw== 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=bhYXVU5OxtMkVW3XxSZWr/Wz0AEa7WBnTGkvmLBOr6I=; b=CRM/DfpCow23LAwPyACMriQ+I337AZyBWOX+1rMQEQRxpk86O2urR9ZBwFREsKCMG7 /7DFR7bOiTzEFg19CBJ4xczGlafpNPtCClyAq1dsCzrsZpxxnXegZfMJwpTWY6QZ2mTh o/SqlqUl4G2bqWmS8QXxtXnD1BPgU2qCKj8qCxElTlh2NfUu2pkODt0i0n+gXTJsxq1d eJjHRnex+hpXGr6+CaJhZZ+3QydCVW0x+O/sq0t34RBlenc5G6W8re62JDCROOwMeaVT IsKRgysVS2cOhLK+ltD04fWicV8AR3XjUAVrJoalAMJrsrTbwD7dCkgEJ0j8gXvMPKKv K3kw== X-Gm-Message-State: AOAM531iMemLb14S3v3I9mM7y64mj+oadPGcI8lDuBLbD4MapKSzGwLc MrP2JKENUpjWURkTAqyoyoA= X-Google-Smtp-Source: ABdhPJyjrjcqJE86UbUuHCAIy7a2diCuAzo72eXvsYDkgkGJtdepruaA11KcB55rm36Jy1wMiGKR4A== X-Received: by 2002:a2e:9988:: with SMTP id w8mr12365362lji.286.1599531121631; Mon, 07 Sep 2020 19:12:01 -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 j12sm9070085lfj.5.2020.09.07.19.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 19:12:01 -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 v6 29/35] i2c: tegra: Check errors for both positive and negative values Date: Tue, 8 Sep 2020 05:10:15 +0300 Message-Id: <20200908021021.9123-30-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200908021021.9123-1-digetx@gmail.com> References: <20200908021021.9123-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 --- 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 44a8c7ae8509..2529d557e0b1 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -977,7 +977,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; @@ -1219,7 +1219,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); @@ -1244,7 +1244,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);