Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2680181imj; Mon, 11 Feb 2019 06:57:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZG74MpuRT9x9abZETgb3aDAvs7C7RtsTEH/iWoZH63xqop9DXTkQAeaA5iDsn1f0EiE25N X-Received: by 2002:a62:b248:: with SMTP id x69mr15223068pfe.256.1549897023131; Mon, 11 Feb 2019 06:57:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897023; cv=none; d=google.com; s=arc-20160816; b=Sc5kJ9zE62VsCmfWKxy/YFl0VIOhEJjJKgjkCzBmLOxnOV/T/iLLtNfuv8oYnGLLkh gX2KptiRvcZpVPOrYZv4rWdJkZFkH4jmXtUX2iV5PLw99Di/flgFxBWd8o4lNlW9F1nh yTjs6YYnaSigqVPrOppE5fyXe2r7+nvFwEJDASFtoqjhFWWT3806YwTuYEiyVdNQjPXx aQ2ohhTK948kBcWkUxBAB/uCqfGYXeYFc5EAHY3wXaTo9SLjcIkAfrhJh+Ks/TFWml6W KJUAZ/sNXlLL3ZeLX3CaT9a366Pl+0fYUC5c3UR71R04FMUvsYMlbs52fP5D8iFw9Vq8 leIg== 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=NrQcOU+U00SZY4lbKXXvdsSCUCOtP/QRMXZMZYPOS5c=; b=KAlU/ZCY5/ubfo2VC751RoBZi4wQagc4NkMW1tVnTrOlaa+3CxI6ZQrXGIg4ylYOi1 peVOEkyrZcNPY6PTTjO5lkTPnjCHv2NfGEwuqEdcjVrpyBPs/RtkNRja4MHpGfF1Inbs Dw8GvIiQjqCurawLXUVoyPjRxAwnmqmQ+vmwgnD3aBqBEcX6zCymjRQmFQxch00GUu4/ pu7doaT64MWCgZ/SX+y70kb6VFguKxTiiNW88A8tnRFcklnm2WA42ihlop6wiFAc/QqN KO6Y71Sfoc/J7dEMXJLqGhva73q33jVZyZhfMzKMH1WGvItHmHCiMI2bPJiw3NJC31rM 9XBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="bF+n/Dli"; 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 v10si10789463plg.82.2019.02.11.06.56.47; Mon, 11 Feb 2019 06:57:03 -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="bF+n/Dli"; 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 S2388853AbfBKOyg (ORCPT + 99 others); Mon, 11 Feb 2019 09:54:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:41324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388844AbfBKOyf (ORCPT ); Mon, 11 Feb 2019 09:54:35 -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 E64CC2229E; Mon, 11 Feb 2019 14:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896874; bh=p6HJD3Gf68SEDgv5n+wX+xSZNYElih4m6kMn6YMU0fQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bF+n/DliiS+Je1QpN4cLRh58zxPia1r0rm9bjr27TTr3zAUmf/yAbCJX2V6ZOMbV1 EvknsJh9iY18a48PJ2YaX61tDfEBQvF46mEV9ePEP0nW1sb802HnOWTeetW+79AA9d CowEAaUKvNCcvLMxiXWDbayeEettmnxi6N/VoJWE= 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.14 002/205] staging: iio: adc: ad7280a: handle error from __ad7280_read32() Date: Mon, 11 Feb 2019 15:16:40 +0100 Message-Id: <20190211141827.343874802@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 f85dde9805e0..f17f700ea04f 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