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 D65E825394C; Mon, 23 Jun 2025 13:21:29 +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=1750684889; cv=none; b=DXqUIck+NOSdxMqsaw+YHVl2SnYa24fUB5I48ngaq8yrBa89W8Cj3lSC7peg+xbuwYC5ZtFXDjcGAdlhhjzJ5/5Cfk9bGBu15/xIsMQTy2KSv6MFY23CorcXaKa098ORwu3tXmT3RK3jFdHw+h4zxIkBIZY4IUMVil47LPCYgf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750684889; c=relaxed/simple; bh=zFV/inA/j+rQ9+2nR6x/C0kAUQdb7dZdLyIky80Qh2U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C4L0ecB66LCUZUXLtNqTzguozFbw7dmX79C21JK2vYo/3ODL0nsOyDs+oc9+QSXnZPzI5KdjcGddws+GSySZ1ifIwXh9sYNL4XfDgBxUMZ9B5PF+Bnq7TQ8bc5QYXiDJQg+u+GO7hxo8bzLFafOlZTluuxAuFHm+Ic0RIPCzjGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=rItRYHQo; 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="rItRYHQo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD38C4CEEA; Mon, 23 Jun 2025 13:21:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750684889; bh=zFV/inA/j+rQ9+2nR6x/C0kAUQdb7dZdLyIky80Qh2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rItRYHQoHYhsRZbugH939ufDIcR+y6YRsa+7JwPJWqazwxMRs2WwP1bBNa0mNIgw3 szh6mOmlY2G5kxlzlwXsIcZsVxLNmZ92LdyI03SED9jUWPOwwBVnQGlP2BkVMr2mGv Fl1bkE6APITSg6MhSaWtRuhUzPlKr124RwYCqR1w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gabriel Shahrouzi , Marcelo Schmitt , Jonathan Cameron Subject: [PATCH 6.15 166/592] staging: iio: ad5933: Correct settling cycles encoding per datasheet Date: Mon, 23 Jun 2025 15:02:04 +0200 Message-ID: <20250623130704.228030133@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@linuxfoundation.org> User-Agent: quilt/0.68 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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gabriel Shahrouzi commit 60638e2a2d4bc03798f00d5ab65ce9b83cb8b03b upstream. The AD5933 datasheet (Table 13) lists the maximum cycles to be 0x7FC (2044). Clamp the user input to the maximum effective value of 0x7FC cycles. Fixes: f94aa354d676 ("iio: impedance-analyzer: New driver for AD5933/4 Impedance Converter, Network Analyzer") Cc: stable@vger.kernel.org Signed-off-by: Gabriel Shahrouzi Reviewed-by: Marcelo Schmitt Link: https://patch.msgid.link/20250420013009.847851-1-gshahrouzi@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/staging/iio/impedance-analyzer/ad5933.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/staging/iio/impedance-analyzer/ad5933.c +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c @@ -411,7 +411,7 @@ static ssize_t ad5933_store(struct devic ret = ad5933_cmd(st, 0); break; case AD5933_OUT_SETTLING_CYCLES: - val = clamp(val, (u16)0, (u16)0x7FF); + val = clamp(val, (u16)0, (u16)0x7FC); st->settling_cycles = val; /* 2x, 4x handling, see datasheet */