From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B9D61C5D77; Wed, 4 Feb 2026 14:46:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216382; cv=none; b=KjMWvZMTbT0KMQcC6HLzJSATIiiEFpmROWKaYlshYRCtfaVHQH4zwDqBuSLH8p8BRhD+Qasg2wx2qTxw2rskApGtt1UUijLOsKX1qO1zvIqQeMwGcsuL9bJe5wRF6G09CDGkM1SKa7LhDdPUW4fuy8Y6AorOuLHwnA/ML8jyGZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770216382; c=relaxed/simple; bh=VVXOmDH4WvD3w4dkaTyoS2o0b5TD4R8up5FFC89qYkM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=K1WQ1qP0SU04cBGgiDO+rhxSnOma+f0XD5XpAugqCrRaQY/bbHZu/0ybbmcos/h5wzZ2Mu1V3ainO+kK3srdYxdJ7bkwcc777caN0B2bQrdKgXRT/vOylueGFbsAh+1Ekv9yPQInCqNI00mtyZYKZW9qrKyeJbs2+n0frCoLwpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=K8/1R6wF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="K8/1R6wF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A031C116C6; Wed, 4 Feb 2026 14:46:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770216381; bh=VVXOmDH4WvD3w4dkaTyoS2o0b5TD4R8up5FFC89qYkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K8/1R6wFBtcrJfKjBZBRBjlzqSrYfM0cNJLJyMI2VCqvot3yDENM/e0gOPF7O9wno pCWZ9zLkdhry/z0PtVPryB15wBrzEXteF7Dj0uRDDK0rmaRhYivEmMShW7dWDk6Csf 8Fga5PIwQfDyDKX+4Xdxpml/QG3W/GwPJCpWqTJA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pavel Zhigulin , Marcelo Schmitt , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.10 072/161] iio: adc: ad7280a: handle spi_setup() errors in probe() Date: Wed, 4 Feb 2026 15:38:55 +0100 Message-ID: <20260204143854.346471252@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143851.755002596@linuxfoundation.org> References: <20260204143851.755002596@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pavel Zhigulin [ Upstream commit 6b39824ac4c15783787e6434449772bfb2e31214 ] The probe() function ignored the return value of spi_setup(), leaving SPI configuration failures undetected. If spi_setup() fails, the driver should stop initialization and propagate the error to the caller. Add proper error handling: check the return value of spi_setup() and return it on failure. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 2051f25d2a26 ("iio: adc: New driver for AD7280A Lithium Ion Battery Monitoring System") Signed-off-by: Pavel Zhigulin Reviewed-by: Marcelo Schmitt Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/staging/iio/adc/ad7280a.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index 0f64b2fbfa7aa..cc66c3d7141aa 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -964,7 +964,9 @@ static int ad7280_probe(struct spi_device *spi) st->spi->max_speed_hz = AD7280A_MAX_SPI_CLK_HZ; st->spi->mode = SPI_MODE_1; - spi_setup(st->spi); + ret = spi_setup(st->spi); + if (ret < 0) + return ret; st->ctrl_lb = FIELD_PREP(AD7280A_CTRL_LB_ACQ_TIME_MSK, pdata->acquisition_time) | FIELD_PREP(AD7280A_CTRL_LB_THERMISTOR_MSK, pdata->thermistor_term_en); -- 2.51.0