Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1046524imu; Fri, 16 Nov 2018 14:53:51 -0800 (PST) X-Google-Smtp-Source: AJdET5fHOOQ3xkZ3N+s7J5t2mv2DaEEzeVmvRVQOvLSD2esmssZkKoszSUvVZr5Kq30fOa5Iw8E+ X-Received: by 2002:a17:902:b701:: with SMTP id d1-v6mr12169084pls.29.1542408831330; Fri, 16 Nov 2018 14:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542408831; cv=none; d=google.com; s=arc-20160816; b=uQqhaD1SXypKJJMwCnlIHF/HhNvjDt3z/dHhJfJPfWqegwt25J3F6qQw8lKcXTxy78 qc0BSF8qWhj8wVZrGPz5aubwAsLH6JpwQrJhwd8Cm54xoVzLuFgPBIU8neqtBYPtOjMt f1pms5HuVqX30RkA1pGZFDqvp2bcAUaeXMCyelTg6G+PfB0H0a0FuWdMsvwqr1M8hlGd QB2H7VcDvwyTfujk6uw9KYtX5RafNEXmDpJIqdFRZdwIHQ75Y+chOFK2iSFjIWYepoV1 ouDWpK532VIuC8m3hLxqWwYnTPCJI0J/30CEYbFqBptAz22b5VdA3BVUkOe3mEbkSP/S Eyvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=OwHcst+enILOIrmgfby8FDaIChOrcGZVIxgWGuwQJZI=; b=qpmEiA0goGDmcowLPbMXu8n+pFH2I4VXpo0bqDPFxHPCjnLSwf3Kagy5CQL1+Epyow /TttBgIPRyCR2YrPEo/Gi4QeboI7ovsdR+6Os2W5QcBS2WBhIpEyNMicLZ2A9UNHKhLn bpnDLMD8MD6XF+kCc/cCFPnZXUFfRAqZD6DrWVV62s35HWoK3JW3RTdX9cuRJwfoVPoO rK+HTe2PXMAXB6itXrkIBe8shNkEfozt3PNNVHEQ5+KwGLCRLN66peKcD+GOF86zGqOo +ZsV9p/frjl6hRXLI8mtereZllQ2z/4j6NsXyPzuNrFMhmJS9CwV1G9Zri1gYevTds22 IpMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fhTFvyia; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h3-v6si34721497pfd.228.2018.11.16.14.53.37; Fri, 16 Nov 2018 14:53:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fhTFvyia; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728839AbeKQJFy (ORCPT + 99 others); Sat, 17 Nov 2018 04:05:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:39882 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725995AbeKQJFy (ORCPT ); Sat, 17 Nov 2018 04:05:54 -0500 Received: by mail-pf1-f193.google.com with SMTP id c72so7373819pfc.6; Fri, 16 Nov 2018 14:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=OwHcst+enILOIrmgfby8FDaIChOrcGZVIxgWGuwQJZI=; b=fhTFvyiamH4EGxbnSXyG3JpZ/JBP3STklHfIMitnqr5oTszVyRaxmHSQcCykJvOBqh dQGqM7vWiapOwwMcqg993RUvn4gvR4FEP2EupK5fgA9pUWYilizKgPHdyuEFjOnaPSwD KdL6Zd6pLKQwYk0eSMZ2wERA5wzf5BA55nEV+Td3vfFrlubPw7tMb+sgoET6SuUCvklB iC9ADUjIyA6Y2fn4UQLEixH37m40KQvEKMb5+d1zni2cdr6JCbZUfMw6bvxFHjGg6ca+ 8oJZqhle5ylkC13k3P091wmWQ50c7d55KStG9gSh2d/ZFSFd39TlhwWaEniLHKo1HNkK YbQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=OwHcst+enILOIrmgfby8FDaIChOrcGZVIxgWGuwQJZI=; b=PJ8O9o3K+qpkWs4zeheXNPnFAUMEAPC3lqRwyzsgxWBL31T8r4Q1X1PuIs7zaqDaVR wA9hT5now5uI1sTwPWp17JIsdKjOCYRegPQxxnXVfHuXAp5FdovnSK/ClLhWde087l+1 88BV+KN1lcWhEoB/cUVt0jqLYpBEvlHsIuT5t5yLZJJnqwoH1QwMpqpT+cUbE2NOUMWj DncEzAiY+onWaKIilJpmrsE77tzIkpREUuOBe2MGnWQczGjtwAst7n3AbsiIbzaKFMAc Qw/876rTldr/HHZ6Ghw0q+Vvkp8XQAnMTuW9ewhilLsVKrV0OMCBO3lRaF7MXiEpT8+/ cEdA== X-Gm-Message-State: AGRZ1gKMHEXzrp9nzde+UW/TqdWOPPjQRItQiiE2DzgUBEYbmoizI07c rNgPGJomXVQ8K9FJleMjo/M= X-Received: by 2002:a63:4e41:: with SMTP id o1mr11889942pgl.282.1542408698201; Fri, 16 Nov 2018 14:51:38 -0800 (PST) Received: from localhost.localdomain ([103.212.140.154]) by smtp.gmail.com with ESMTPSA id 34sm47407359pgp.90.2018.11.16.14.51.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 14:51:37 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] Staging: iio: adt7316: Add an extra check for 'ret' equals to 0 Date: Sat, 17 Nov 2018 04:21:32 +0530 Message-Id: <20181116225132.24459-1-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ret = 0 indicates a case of no error but no data read from the bus which is an invalid case. This case doesn't ever happen in reality. It should perhaps be handled for correctness though. Signed-off-by: Shreeya Patel --- drivers/staging/iio/addac/adt7316-i2c.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c index 856bcfa60c6c..473e5e34ec00 100644 --- a/drivers/staging/iio/addac/adt7316-i2c.c +++ b/drivers/staging/iio/addac/adt7316-i2c.c @@ -30,6 +30,10 @@ static int adt7316_i2c_read(void *client, u8 reg, u8 *data) } ret = i2c_smbus_read_byte(client); + + if (!ret) + return -EIO; + if (ret < 0) { dev_err(&cl->dev, "I2C read error\n"); return ret; -- 2.17.1