From: Tamura Dai <kirinode0@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
Tamura Dai <kirinode0@gmail.com>
Subject: [PATCH] Input: pwm-beeper - add range check for parameter.
Date: Mon, 6 Jan 2025 11:55:28 +0900 [thread overview]
Message-ID: <20250106025542.13555-1-kirinode0@gmail.com> (raw)
The parameter "beeper-hz" range is defined in pwm-beeper.yaml,
so add range check.
Signed-off-by: Tamura Dai <kirinode0@gmail.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
next reply other threads:[~2025-01-06 2:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-06 2:55 Tamura Dai [this message]
2025-01-06 7:13 ` [PATCH] Input: pwm-beeper - add range check for parameter Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250106025542.13555-1-kirinode0@gmail.com \
--to=kirinode0@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).