lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 24 Jun 2020 15:39:52 +0000
From:   Roy Im <roy.im.opensource@...semi.com>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        Roy Im <roy.im.opensource@...semi.com>
CC:     Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Brian Masney <masneyb@...tation.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Greg KH <gregkh@...uxfoundation.org>,
        Lee Jones <lee.jones@...aro.org>, Luca Weiss <luca@...tu.xyz>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Pascal PAILLET-LME <p.paillet@...com>,
        Rob Herring <robh@...nel.org>,
        Samuel Ortiz <sameo@...ux.intel.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Support Opensource <Support.Opensource@...semi.com>,
        "linux-input@...r.kernel.org" <linux-input@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>
Subject: RE: [RESEND PATCH V13 3/3] Input: new da7280 haptic driver

On Wed, Jun 24, 2020 at 10:37 PM, Uwe Kleine-König wrote:
> On Wed, Jun 24, 2020 at 12:04:24PM +0900, Roy Im wrote:
> > Hello Uwe,
> >
> > On Tue, June 23, 2020 11:41 PM, Uwe Kleine-König wrote:
> > >
> > > Hello,
> > >
> > > On Mon, Jun 15, 2020 at 08:40:23PM +0900, Roy Im wrote:
> > > > Adds support for the Dialog DA7280 LRA/ERM Haptic Driver with
> > > > multiple mode and integrated waveform memory and wideband support.
> > > > It communicates via an I2C bus to the device.
> > > >
> > > > Signed-off-by: Roy Im <roy.im.opensource@...semi.com>
> > > >
> > > > +		period2freq = 1000000 / state.period;
> > > > +		if (period2freq < DA7280_MIN_PWM_FREQ_KHZ ||
> > > > +		    period2freq > DA7280_MAX_PWM_FREQ_KHZ) {
> > > > +			dev_err(dev, "Not supported PWM frequency(%d)\n",
> > > > +				period2freq);
> > >
> > > Doesn't the compiler warn here about period2freq being unsigned and %d being for signed int values?
> > >
> > > For my (non-native) English ear s/Not supported/Unsupported/ sounds
> > > better. Also my eyes would be pleases by a space before the opening brace.
> >
> > I didn't see any warning message, but I will change/improve them to proper one and the log as below.
> >
> > 		period2freq = 1000000 / state.period;
> > 		if (period2freq < DA7280_MIN_PWM_FREQ_KHZ ||
> > 		    period2freq > DA7280_MAX_PWM_FREQ_KHZ) {
> > 			dev_err(dev, "Unsupported PWM frequency (%u)\n",
> > 				period2freq);
> > 			return -EINVAL;
> > 		}
> > If you look ok, let me update this so.
> 
> looks fine.
> 
> Note that you don't need the division if you check for:
> 
> 	if (state.period > 100000 || state.period < 4000) {
> 		...
> 
> (maybe the compiler is already clever enough to get rid of the division for you, but then the check is:
> 
> 	if (state.period > 100000 || state.period < 3985) {
> 
> because of rounding errors.)

OK, you are right, that will be better. So let me change that as below if you look fine.
	/* Check PWM period, PWM freq = 1000000 / state.period.
	 * The valid PWM freq range: 10k ~ 250kHz.
	 */
	if (state.period > 100000 || state.period < 3985) {
		dev_err(dev, "Unsupported PWM period (%u)\n",
			state.period);
		return -EINVAL;
	}
> 
> Best regards
> Uwe
> 
> --
> Pengutronix e.K.                           | Uwe Kleine-König            |
> Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ