[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250106025542.13555-1-kirinode0@gmail.com>
Date: Mon, 6 Jan 2025 11:55:28 +0900
From: Tamura Dai <kirinode0@...il.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Tamura Dai <kirinode0@...il.com>
Subject: [PATCH] Input: pwm-beeper - add range check for parameter.
The parameter "beeper-hz" range is defined in pwm-beeper.yaml,
so add range check.
Signed-off-by: Tamura Dai <kirinode0@...il.com>
---
drivers/input/misc/pwm-beeper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index 0e19e97d98ec..455054f9aae6 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -153,7 +153,7 @@ static int pwm_beeper_probe(struct platform_device *pdev)
INIT_WORK(&beeper->work, pwm_beeper_work);
error = device_property_read_u32(dev, "beeper-hz", &bell_frequency);
- if (error) {
+ if (error || (bell_frequency < 10) || (bell_frequency > 10000)) {
bell_frequency = 1000;
dev_dbg(dev,
"failed to parse 'beeper-hz' property, using default: %uHz\n",
--
2.45.2
Powered by blists - more mailing lists