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]
Message-ID: <20140128181206.GB31977@saruman.home>
Date:	Tue, 28 Jan 2014 12:12:06 -0600
From:	Felipe Balbi <balbi@...com>
To:	David Cohen <david.a.cohen@...ux.intel.com>
CC:	Felipe Balbi <balbi@...com>, "xinhui.pan" <xinhuix.pan@...el.com>,
	<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>,
	<linus.walleij@...aro.org>, <gnurou@...il.com>,
	<yanmin_zhang@...ux.intel.com>
Subject: Re: [PATCH] gpio-intel-mid: fix the incorrect return of idle callback

On Tue, Jan 28, 2014 at 09:24:13AM -0800, David Cohen wrote:
> On Tue, Jan 28, 2014 at 10:49:37AM -0600, Felipe Balbi wrote:
> > On Tue, Jan 28, 2014 at 04:50:57PM +0800, xinhui.pan wrote:
> > > From: "xinhui.pan" <xinhuiX.pan@...el.com>
> > > 
> > > intel_gpio_runtime_idle should return correct error code if it do fail.
> > > make it more correct even though -EBUSY is the most possible return value.
> > > 
> > > Signed-off-by: bo.he <bo.he@...el.com>
> > > Signed-off-by: xinhui.pan <xinhuiX.pan@...el.com>
> > > ---
> > >  drivers/gpio/gpio-intel-mid.c |    4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpio/gpio-intel-mid.c b/drivers/gpio/gpio-intel-mid.c
> > > index d1b50ef..05749a3 100644
> > > --- a/drivers/gpio/gpio-intel-mid.c
> > > +++ b/drivers/gpio/gpio-intel-mid.c
> > > @@ -394,7 +394,9 @@ static const struct irq_domain_ops intel_gpio_irq_ops = {
> > >  
> > >  static int intel_gpio_runtime_idle(struct device *dev)
> > >  {
> > > -	pm_schedule_suspend(dev, 500);
> > > +	int err = pm_schedule_suspend(dev, 500);
> > > +	if (err)
> > > +		return err;
> > >  	return -EBUSY;
> > 
> > wait, is it only me or this would look a lot better as:
> > 
> > static int intel_gpio_runtime_idle(struct device *dev)
> > {
> > 	return pm_schedule_suspend(dev, 500);
> > }
> 
> The reply to your suggestion is probably in this commit :)
> 
> ---
> commit 45f0a85c8258741d11bda25c0a5669c06267204a
> Author: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> Date:   Mon Jun 3 21:49:52 2013 +0200
> 
>     PM / Runtime: Rework the "runtime idle" helper routine
> ---
> 
> We won't return 0 from here.

so you never want to return 0, why don't you, then:

static int intel_gpio_runtime_idle(struct device *dev)
{
	pm_schedule_suspend(dev, 500);
	return -EBUSY;
}

just like drivers/tty/serial/mfd.c::serial_hsu_runtime_idle() is doing ?

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ