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 128603D994; Wed, 4 Feb 2026 15:12:06 +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=1770217926; cv=none; b=csFDHslT8/cimU7QtZL8c16IZvjXADiVuUudzUWcfVyakDzavBVKpPmvmnMMsGZHATOhqvFlsbcQYxLxvLizu9ZSFNe2E+g06qysTgpd2P6+f/6tJqP0hqBPr12AcaN1G0nDnfAA6sXsZjCWfXIVdzgjCZaWwOeBeETiMaaVjPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770217926; c=relaxed/simple; bh=QrY7Mj5AKqaLwBO7ly2fg1nBp9f2ny7VQr25fq64i7A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ojOVQsOOKJzQULZTYgaS7Y9OSPL1GekssMicVFfsWJzyc9/DTm1lQsIcaWWIvwuREXhbE0sUmLcTyYSqabMfQAUFQ0kTxTU360krpKjxb2gNQZhsbNxTDrvjSBbuDYHHV/ff9xPLEg6fK40nakzuQHijYmpUnLQpkOhkCctKPRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xh1eeeOd; 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="xh1eeeOd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 769B5C4CEF7; Wed, 4 Feb 2026 15:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770217926; bh=QrY7Mj5AKqaLwBO7ly2fg1nBp9f2ny7VQr25fq64i7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xh1eeeOdGC4UA4/+WyZs/SGSsz+Ir0gO1NsOgajvz9hSHu61XO7ZlGaD1LeVgmtUQ w4jB+cItdLJIEZNW5n/Hxg26xyOQ1nv57AIrx08BQ97QUMSPSMGjLCcVPfA33CcTGb uOir3JId2UbT6K2a4E2mtKnlOfVpAAtPjIYjRrvE= 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 6.1 127/280] iio: adc: ad7280a: handle spi_setup() errors in probe() Date: Wed, 4 Feb 2026 15:38:21 +0100 Message-ID: <20260204143914.206822501@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260204143909.614719725@linuxfoundation.org> References: <20260204143909.614719725@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 6.1-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/iio/adc/ad7280a.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/ad7280a.c b/drivers/iio/adc/ad7280a.c index 9080c795dcb7e..10cc623bf62a3 100644 --- a/drivers/iio/adc/ad7280a.c +++ b/drivers/iio/adc/ad7280a.c @@ -1028,7 +1028,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, st->acquisition_time) | FIELD_PREP(AD7280A_CTRL_LB_THERMISTOR_MSK, st->thermistor_term_en); -- 2.51.0