From: Arthur LAMBERT <lambertarthur22@gmail.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
"Lothar Waßmann" <LW@KARO-electronics.de>
Subject: Re: Handle pwm with sysfs with recent kernel
Date: Wed, 9 Jan 2019 10:26:51 +0100 [thread overview]
Message-ID: <20190109092651.GA27151@arthur-bzh> (raw)
In-Reply-To: <20190109092006.35364dwcfiindd7c@pengutronix.de>
It is an error due to new check from this commit :
[arthur * dreem-linux-4.19] git show ef2bf4997f7da6efa8540d9cf726c44bf2b863af
commit ef2bf4997f7da6efa8540d9cf726c44bf2b863af
Author: Brian Norris <briannorris@chromium.org>
Date: Fri May 27 09:45:49 2016 -0700
pwm: Improve args checking in pwm_apply_state()
It seems like in the process of refactoring pwm_config() to utilize the
newly-introduced pwm_apply_state() API, some args/bounds checking was
dropped.
(...)
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index dba3843..ed337a8c 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -457,7 +457,8 @@ int pwm_apply_state(struct pwm_device *pwm, struct pwm_state *state)
{
int err;
- if (!pwm)
+ if (!pwm || !state || !state->period ||
+ state->duty_cycle > state->period)
return -EINVAL;
(...)
I guess that I have to configure the period and the duty cycle before
enabling the pwm to be compatible with this kernek. I will update my
userspace code.
prev parent reply other threads:[~2019-01-09 9:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190108100739.GA9046@arthur-bzh>
2019-01-08 22:21 ` Handle pwm with sysfs with recent kernel Uwe Kleine-König
2019-01-09 8:25 ` Lothar Waßmann
2019-01-09 9:20 ` Uwe Kleine-König
2019-01-09 9:26 ` Arthur LAMBERT [this message]
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=20190109092651.GA27151@arthur-bzh \
--to=lambertarthur22@gmail.com \
--cc=LW@KARO-electronics.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pwm@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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).