Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2776562imj; Mon, 11 Feb 2019 08:17:53 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia1A/xIB1OrCBe5HRgyeR7u1r07WaBExwT9j/+r+mAodLTy522kU8X3ff1AksV3/c8LE3eT X-Received: by 2002:a63:c946:: with SMTP id y6mr5575601pgg.109.1549901873573; Mon, 11 Feb 2019 08:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901873; cv=none; d=google.com; s=arc-20160816; b=Z2rVFBXvyRxN83qeUGWNHaX3duZoXnOznHr45RfYDAcUoufFlKPzd+NZ/q+t+LhPVj fvBWseJQkSXRP6EFfDp5Oy7xZ8fKG6nIOzBbTMWJIjc4x/RTcZkDprCtOmDQqCUlO0D7 BCD/ikVHll3r0qd8/DQ6Sk8+yStiZP18KOY+EAEvWtBpZWu50zng3ddEIBaX7E+EbmUu RNzfvTIzbn8zdhBpCnuPMhp2qaUw3xKBo75N6TDxqOiT04ApICXfhpb4rln96dwx/ipd PRkik5MUYSiCyEjGRvdBo3ubD1gSE3vWjv5pFS69IXolUAlI58HAGXeT43za4kk9Yaoa fnbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z07PVkSwYPXGtdb48gf1o2SpZJQcWnW+3+FvzzbFTrw=; b=W2AYuj3PRSFJZ0BH9KXqYY3Ud23nf2V+BHdDSpTIgsvfmhl556rF1rzo7M+23/PWar LgWdwN14US53afTM2Yoy7KUSolGNpIkrjRJFttYiI/sPx0jYDKRpoK1fd1Yxw4ys85lx mStKfxdNPBsg0pRyOAGRe2Y3kH1cKGGR9fxOGY0j5fMB9Yd/lkpfwE/YI4ZNR6jGQIxj SiXWyKtDKSmGgCqvc2CXlHn4FoQMNdIC/IczPcT8wDE6exUgM/O9Df6hoUk2JCsXHzcL yaBHHDmaoBlK1b9E24ZU2WsfXdqyFpZ7d9CJQLuZXMYmAsY1/4OV3G6GGIkWYYDAhmTx nryw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="CehTJvk/"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g128si9591792pgc.352.2019.02.11.08.17.33; Mon, 11 Feb 2019 08:17:53 -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=@kernel.org header.s=default header.b="CehTJvk/"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729151AbfBKQPG (ORCPT + 99 others); Mon, 11 Feb 2019 11:15:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:53750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728421AbfBKOU6 (ORCPT ); Mon, 11 Feb 2019 09:20:58 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 57E6320844; Mon, 11 Feb 2019 14:20:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549894857; bh=7XQYFRyDaAObZBBTW712cBVn+es+CrTOGAQa/dadKmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CehTJvk/5fBtkI4IA1QDTzFmhIaSXmPcd2yX2FNegl/EIsFA3fN79xop75hr0rOUS mo0u0LUHqYoOZJEsZ05zS3wC7A5qaIkX8B4+0lgbQh7g7OCZCYuuD5JlUP9mun+h+/ 316KHh1oAj6VU5KQjKmLulfRSsJNSSb2KjYWNXfE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slawomir Stepien , Jonathan Cameron , Sasha Levin Subject: [PATCH 4.20 003/352] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Date: Mon, 11 Feb 2019 15:13:50 +0100 Message-Id: <20190211141846.724109043@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 0559ef7fde67bc6c83c6eb6329dbd6649528263e ] Inside __ad7280_read32(), the spi_sync_transfer() can fail with negative error code. This change will ensure that this error is being passed up in the call stack, so it can be handled. Signed-off-by: Slawomir Stepien Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/staging/iio/adc/ad7280a.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 58420dcb406d..cbeb52485a31 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -256,7 +256,9 @@ static int ad7280_read(struct ad7280_state *st, unsigned int devaddr, if (ret) return ret; - __ad7280_read32(st, &tmp); + ret = __ad7280_read32(st, &tmp); + if (ret) + return ret; if (ad7280_check_crc(st, tmp)) return -EIO; @@ -294,7 +296,9 @@ static int ad7280_read_channel(struct ad7280_state *st, unsigned int devaddr, ad7280_delay(st); - __ad7280_read32(st, &tmp); + ret = __ad7280_read32(st, &tmp); + if (ret) + return ret; if (ad7280_check_crc(st, tmp)) return -EIO; @@ -327,7 +331,9 @@ static int ad7280_read_all_channels(struct ad7280_state *st, unsigned int cnt, ad7280_delay(st); for (i = 0; i < cnt; i++) { - __ad7280_read32(st, &tmp); + ret = __ad7280_read32(st, &tmp); + if (ret) + return ret; if (ad7280_check_crc(st, tmp)) return -EIO; @@ -370,7 +376,10 @@ static int ad7280_chain_setup(struct ad7280_state *st) return ret; for (n = 0; n <= AD7280A_MAX_CHAIN; n++) { - __ad7280_read32(st, &val); + ret = __ad7280_read32(st, &val); + if (ret) + return ret; + if (val == 0) return n - 1; -- 2.19.1