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 61826257855; Sun, 7 Jun 2026 10:35:53 +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=1780828554; cv=none; b=En1wYb3VW4Tcau8S/5twnJ8DxnoaMAiqgcZYSe/WNg+TeoOJZc0QPOACAFzaMpWyTYGnfgLxlGRKC9pRYq5BW0idQIlu2+U9qT6xrxJjwss+0XD52768UNZ85um8th4lVi7Fh2jxhrHTtAHNPMDW63VWoguLXQNuaEZCeDoQWwI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780828554; c=relaxed/simple; bh=P0Ac4pc0A56G5YVRS6C0ufhXExg09z+9ZUNB2fBF6yw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MJ7eCk4r3dfQT1uw1hOu4WRDxEV7d04rdMT1vLzJoLQshLF/7ynobR5s1rMyykrl2ieNfUoE5dADsCS4R8M+Xc8HHajoNwZi2xVtlGyrwLcZMbVb7mRNY1sKf6ervFCMC4ScFMxId0rOgdl+EukCe/xMfmXSAvsHsJANAql854I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Jm3z9RcR; 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="Jm3z9RcR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D5561F00893; Sun, 7 Jun 2026 10:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780828553; bh=jYlmI8X3rRSML1evItXx/tV+hInpVjxWALXdAtcpkQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Jm3z9RcRhT7h3fiZam7nGX80l4zVViyM+CHb8v4dqe+C1ivAGUKpDo6uSafw1gTra WWmhk/UgobYXmCF/ke/4awyjyf1glIv9JBbCXaS3mxW4bcvTnKyroSvsf/YVP8iJT1 V68d7RMAO1zF6m7r5L6Esatz0xicSexAYTSf3cPc= 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 7.0 183/332] iio: adc: viperboard: Fix error handling in vprbrd_iio_read_raw Date: Sun, 7 Jun 2026 11:59:12 +0200 Message-ID: <20260607095734.786500487@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095728.031258202@linuxfoundation.org> References: <20260607095728.031258202@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 7.0-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,