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 053A939E199; Thu, 15 Jan 2026 17:18:12 +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=1768497493; cv=none; b=RkP0PI2lbrSWb50uIQctQZwT6KSUH9mlBj0Z6PHrchBQxvwRzCnRvjUCPREBcWRKCduPl4qPqRjZoEp4vqd7STxL5Yrfe7jLlquyAfGov5JNVoVQID1823E7u8FcBhcUYf4isrfVQHjwPcJxecB0PSVYxcB2Dq391FRj2+WzzaU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768497493; c=relaxed/simple; bh=2POK2Aj27KOaveBtUn1bdLNpW4dBM48u+MiMH3JjvNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GyjwP22EZZH4bM1wwfIqPtFVeYqciyF07FmamdjxVBLd/yqcLc8e1iXfMnxws4WAUGbeP/CZ32bNF/eQpzIt33mlWDSQmjy4+61M1YBPMOjXX90XePixtPRsj0wTN+1a3s1PDpY6tH0RkGk8W0KsszDjP2lbVFhQPnWQLZ0IlRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nOJZnwJP; 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="nOJZnwJP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43F32C116D0; Thu, 15 Jan 2026 17:18:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1768497492; bh=2POK2Aj27KOaveBtUn1bdLNpW4dBM48u+MiMH3JjvNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nOJZnwJPG4w6qJYumj/wrJy+Ol08CGt7dXpUwi7sD1Uu0rbwjmRWRIuQClVIxHmua bY0GbNP/t5N0mucx2vYRMNSkQ88su05QWJw+4JlrSAJRhBpcQzPEoWe22mrQpU0QO1 kDhscpPHFSZRFi6ATTmfJdEEzvtziniN5efoxIqs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ivan Abramov , Sebastian Reichel , Sasha Levin Subject: [PATCH 5.15 068/554] power: supply: wm831x: Check wm831x_set_bits() return value Date: Thu, 15 Jan 2026 17:42:14 +0100 Message-ID: <20260115164248.704234161@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260115164246.225995385@linuxfoundation.org> References: <20260115164246.225995385@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ivan Abramov [ Upstream commit ea14bae6df18942bccb467fcf5ff33ca677b8253 ] Since wm831x_set_bits() may return error, log failure and exit from wm831x_usb_limit_change() in such case. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 626b6cd5f52e ("power: wm831x_power: Support USB charger current limit management") Signed-off-by: Ivan Abramov Link: https://patch.msgid.link/20251009170553.566561-1-i.abramov@mt-integration.ru Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/wm831x_power.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/power/supply/wm831x_power.c b/drivers/power/supply/wm831x_power.c index 4cd2dd8700395..902e01a3fc730 100644 --- a/drivers/power/supply/wm831x_power.c +++ b/drivers/power/supply/wm831x_power.c @@ -144,6 +144,7 @@ static int wm831x_usb_limit_change(struct notifier_block *nb, struct wm831x_power, usb_notify); unsigned int i, best; + int ret; /* Find the highest supported limit */ best = 0; @@ -156,8 +157,13 @@ static int wm831x_usb_limit_change(struct notifier_block *nb, dev_dbg(wm831x_power->wm831x->dev, "Limiting USB current to %umA", wm831x_usb_limits[best]); - wm831x_set_bits(wm831x_power->wm831x, WM831X_POWER_STATE, - WM831X_USB_ILIM_MASK, best); + ret = wm831x_set_bits(wm831x_power->wm831x, WM831X_POWER_STATE, + WM831X_USB_ILIM_MASK, best); + if (ret < 0) { + dev_err(wm831x_power->wm831x->dev, + "Failed to set USB current limit: %d\n", ret); + return ret; + } return 0; } -- 2.51.0