From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 6577346AF17; Tue, 16 Jun 2026 18:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635490; cv=none; b=fwvNnk7zrudfsjTV08Krnahb3iWY13wBKnSPRgcY83agIc+fWFBvyFavbw8vTVVJVsFtFYvO89RrKdKJmXOvOa/l0hJXseHeg+7Gk6BMIX7Fh0mTWubUqJ9AuLYbfRIzS1nsKQLD49lwG3Mzr4DRsboMmn7RTcv4ekWj+bDBmjU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781635490; c=relaxed/simple; bh=bIVn07w4yYn2uWIaiCs9TyV059TxsM2eu6Bz185zQQc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=obQRYvqMF9xKLP2Jh5OWFguazoOjAlyvUhAgBoAzSsLqQifPbigYLBnEuSwsYJaTtpjxhN96+P0GY8cY1Fh6CMvzcnJabmVI06ZhJW7fjSousoWh4rOcUTDlEiTn4UuJthbzeEnd0mFLifCELDuAy7F0oOXi/isOj0zrOegklj8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NW5Zbv03; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NW5Zbv03" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A25B41F000E9; Tue, 16 Jun 2026 18:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781635487; bh=Gpw7o2hVUAQTFsQfEJPJahpDXeOk5JVbfDMWWGZRoZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NW5Zbv03fX2oAoN1skrS4H52J1QiMPSIdTHHnFsdPmq/KUU4jHEs7I79h02xwP/po 0QWpI2SmjVuHZXfdSaOsx6xG8dXZufM8cUOFGMXjrwEJ3zDHwzoKvZEi7SJXngCY0D uaXGUIqQDqbCrybhlixZTqF+j3IEZBnGdORM9kWc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Salah Triki , Joshua Crofts , Maxwell Doose , =?UTF-8?q?Nuno=20S=C3=A1?= , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 059/342] iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw Date: Tue, 16 Jun 2026 20:25:55 +0530 Message-ID: <20260616145051.008789792@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Salah Triki commit 422b5bbf333f75fb486855ad0eedc23cf21f3277 upstream. The driver proceeds to the reception phase even if the preceding transmission fails. This uses a goto error label for an early bail out and ensures the mutex is properly unlocked in case of failure. Fixes: ffd8a6e7a778 ("iio: adc: Add viperboard adc driver") Signed-off-by: Salah Triki Reviewed-by: Joshua Crofts Reviewed-by: Maxwell Doose Reviewed-by: Nuno Sá Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/viperboard_adc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/iio/adc/viperboard_adc.c +++ b/drivers/iio/adc/viperboard_adc.c @@ -70,8 +70,10 @@ static int vprbrd_iio_read_raw(struct ii VPRBRD_USB_TYPE_OUT, 0x0000, 0x0000, admsg, sizeof(struct vprbrd_adc_msg), VPRBRD_USB_TIMEOUT_MS); if (ret != sizeof(struct vprbrd_adc_msg)) { - dev_err(&iio_dev->dev, "usb send error on adc read\n"); + mutex_unlock(&vb->lock); error = -EREMOTEIO; + dev_err(&iio_dev->dev, "usb send error on adc read\n"); + goto error; } ret = usb_control_msg(vb->usb_dev,