From nobody Sat Feb 7 20:21:57 2026 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (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 E8AAB2C2340 for ; Tue, 2 Dec 2025 18:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764699227; cv=none; b=ZaPAt74raVGRVL19gY9rAElxY2FvH7B5CDHHluHTdtFSQ+7NqvOVws8V/P5EuA12Imk26pvw1P1KVtQZ5cB1Tcmt9a4wOvST5aHixWMAUXhCU8jysww2kFH6m6w7yAkKeE3A6X/AVRAqe+PZv/ulk+6zZplwPpJgmHKs/jSvHN0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764699227; c=relaxed/simple; bh=bdthcyLeDFW7Ku0MwoZu7F1rr9YLEfvT55xqiidmiKI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=kFlm68ptdKBzhxoUtlRJkHqdME4oKPcJsTWqtY6IpT5+Hf6xjBLx0RSaYj5UXcAH88jugLYKdgsTKVYcKqJWM/EwVoU0zyv70fNZoR4ReBBTGzSYunCTRqQH2o+ejmkwpVSEnmbC08G9ASFtzolGLCkAwGuXzHD556OgCvvQGHQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ejxh1dHb; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ejxh1dHb" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1764699212; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=viWv9NWMNAydT5kwQiEWz7g+oXce/Xi4AyaKIz18PVU=; b=ejxh1dHbIG7kdTsfR12Zf8ncmCgRg1JU1FgJbkPSMzVddtKQJVyI3t8iTNqJSDRe7hi4r8 8XCM8VxDJJFjKhkaVm/e/eCFPrAKw6A3lMPZljVLhbmXHwa90+dWticbPxgePvg3JSvThB imgq6h2Mnw86G9tpQbqxGZbdAXKCPqE= From: Thorsten Blum To: Marius Cristea , Jonathan Cameron , David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko Cc: Thorsten Blum , stable@vger.kernel.org, Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: adc: PAC1934: Fix clamped value in pac1934_reg_snapshot Date: Tue, 2 Dec 2025 19:13:06 +0100 Message-ID: <20251202181307.510970-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" The local variable 'curr_energy' was never clamped to PAC_193X_MIN_POWER_ACC or PAC_193X_MAX_POWER_ACC because the return value of clamp() was not used. Fix this by assigning the clamped value back to 'curr_energy'. Cc: stable@vger.kernel.org Fixes: 0fb528c8255b ("iio: adc: adding support for PAC193x") Signed-off-by: Thorsten Blum --- drivers/iio/adc/pac1934.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iio/adc/pac1934.c b/drivers/iio/adc/pac1934.c index 48df16509260..256488d3936b 100644 --- a/drivers/iio/adc/pac1934.c +++ b/drivers/iio/adc/pac1934.c @@ -665,7 +665,8 @@ static int pac1934_reg_snapshot(struct pac1934_chip_inf= o *info, /* add the power_acc field */ curr_energy +=3D inc; =20 - clamp(curr_energy, PAC_193X_MIN_POWER_ACC, PAC_193X_MAX_POWER_ACC); + curr_energy =3D clamp(curr_energy, PAC_193X_MIN_POWER_ACC, + PAC_193X_MAX_POWER_ACC); =20 reg_data->energy_sec_acc[cnt] =3D curr_energy; } --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4