From patchwork Tue Sep 29 22:18:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 254671 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 B3E26C47420 for ; Tue, 29 Sep 2020 22:22:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5580A2075F for ; Tue, 29 Sep 2020 22:22:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JGRoeWWK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728752AbgI2WUm (ORCPT ); Tue, 29 Sep 2020 18:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728287AbgI2WUk (ORCPT ); Tue, 29 Sep 2020 18:20:40 -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 EE1CBC0613D0; Tue, 29 Sep 2020 15:20:39 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id a15so5355125ljk.2; Tue, 29 Sep 2020 15:20:39 -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=xZh9DUwMiABr7Gp9RmerC4SnMDMlQAanRqXDCmR4TSU=; b=JGRoeWWKH4JfUv6+Y0dsJyLqp8LeSI+eFst1unS2Z4Qe+kP+AqkwbpZe6ovtbaGeqd UngcNBusY0IHuGNcDTwU9JCByhjoKF88mnTM+bwI5ockaUE0xtnWpgZ9+lVGBsKJKqVz /FAEO1FPtLiAi5a2ZfGZrG+aM16sHIUu9j5ByHyeNuqrldtBY47F4HG3ho+38xMPgXPq iIurz9/MilJbxnoxmsni/B1WH03y/qkmXVOL3/7UcEIRtWvRY0+YPO4BuWESHjdvmHsZ 9CfDem3WUAwD2MxJVd4TVR1bxSxWoXS1v0zcjfXYNFNihF4wD6BY75rGg2W4ESgW4fdK kV4Q== 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=xZh9DUwMiABr7Gp9RmerC4SnMDMlQAanRqXDCmR4TSU=; b=NT87y4Lu/p2sn4HrjBHEa9SXkhOSzXTEGk1MoW1poJbSlomt1c5FZ7RlyXSaU6hnm7 PxNmoC6GgldvAEOB4dLp9sbmXp+cEj83UvUJPIkR19BuM6LV47aLphY5BV0M50WCb9Zp bkb1l65rVON0EDfKBMBVm2m1oV420RMAD6BHQZp49AUsMmWHQaApdyomRXyEFWiQ0BXo x0wh9Z5qESrid3TnqZ+zclUh85ls7hwyPg6SB5vbAGGY8dbZdBF9aZPfxkDlZhpH1wvc kCeAWbZ6nSVc5QVXOGmYH4Tn6o1nnxYo4GEBypfLdeeOgVK48OWpTq8El2qE09BgZz49 Aq4Q== X-Gm-Message-State: AOAM530g0+tpa2KcSnbKFOy/gvcc2wWZlRybszgyX107hexiuFmRPo1b 2uJjY59MX/XPtoXbn7ePDso= X-Google-Smtp-Source: ABdhPJy1SZUxrjoQKujJL/m12RY0cXLNEdMSIzU/BuEaAeILDJsMgn9QlrjXlydR739Sydh1/6y8Tg== X-Received: by 2002:a2e:a411:: with SMTP id p17mr1951937ljn.282.1601418038424; Tue, 29 Sep 2020 15:20:38 -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 q18sm3379750lfr.138.2020.09.29.15.20.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 15:20:34 -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 v9 03/32] i2c: tegra: Handle potential error of tegra_i2c_flush_fifos() Date: Wed, 30 Sep 2020 01:18:46 +0300 Message-Id: <20200929221915.10979-4-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200929221915.10979-1-digetx@gmail.com> References: <20200929221915.10979-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org Technically the tegra_i2c_flush_fifos() may fail and transfer should be aborted in this case, but this shouldn't ever happen in practice unless there is a bug somewhere in the driver. Let's add the error check just for completeness. Reviewed-by: Michał Mirosław Reviewed-by: Andy Shevchenko Reviewed-by: Thierry Reding Tested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 4e7d0eec0dd3..88d6e7bb14a2 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -1177,7 +1177,9 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, bool dma; u16 xfer_time = 100; - tegra_i2c_flush_fifos(i2c_dev); + err = tegra_i2c_flush_fifos(i2c_dev); + if (err) + return err; i2c_dev->msg_buf = msg->buf; i2c_dev->msg_buf_remaining = msg->len;