Patchwork [4/4] staging: ste_rmi4: Suppress 'ignoring return value of ‘regulator_enable()' warning

login
register
mail settings
Submitter Lee Jones
Date May 2, 2013, 3:48 p.m.
Message ID <1367509690-24022-5-git-send-email-lee.jones@linaro.org>
Download mbox | patch
Permalink /patch/241035/
State New
Headers show

Comments

Lee Jones - May 2, 2013, 3:48 p.m.
drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
        In function ‘synaptics_rmi4_resume’:
drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
        warning: ignoring return value of ‘regulator_enable’, declared
        with attribute warn_unused_result [-Wunused-result

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Srinidhi Kasagar - May 3, 2013, 7:07 a.m.
On Thu, May 02, 2013 at 17:48:10 +0200, Lee Jones wrote:
> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
>         In function ‘synaptics_rmi4_resume’:
> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
>         warning: ignoring return value of ‘regulator_enable’, declared
>         with attribute warn_unused_result [-Wunused-result
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: devel@driverdev.osuosl.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> index fe667dd..c4d013d 100644
> --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
>  	unsigned char intr_status;
>  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
>  
> -	regulator_enable(rmi4_data->regulator);
> +	retval = regulator_enable(rmi4_data->regulator);
> +	if (retval < 0)
> +		return retval;
Does it make sense to add a dev_err?


Otherwise, you can add my
Acked-by:srinidhi kasagar <srinidhi.kasagar@stericsson.com> for this series.

>  
>  	enable_irq(rmi4_data->i2c_client->irq);
>  	rmi4_data->touch_stopped = false;
> -- 
> 1.7.10.4
>
Lee Jones - May 3, 2013, 7:11 a.m.
On Fri, 03 May 2013, Srinidhi Kasagar wrote:

> On Thu, May 02, 2013 at 17:48:10 +0200, Lee Jones wrote:
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
> >         In function ‘synaptics_rmi4_resume’:
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
> >         warning: ignoring return value of ‘regulator_enable’, declared
> >         with attribute warn_unused_result [-Wunused-result
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: devel@driverdev.osuosl.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > index fe667dd..c4d013d 100644
> > --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
> >  	unsigned char intr_status;
> >  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
> >  
> > -	regulator_enable(rmi4_data->regulator);
> > +	retval = regulator_enable(rmi4_data->regulator);
> > +	if (retval < 0)
> > +		return retval;
> Does it make sense to add a dev_err?

Yes, I can do that.

> Otherwise, you can add my
> Acked-by:srinidhi kasagar <srinidhi.kasagar@stericsson.com> for this series.

Thanks.

> >  
> >  	enable_irq(rmi4_data->i2c_client->irq);
> >  	rmi4_data->touch_stopped = false;
Dan Carpenter - May 5, 2013, 2:18 p.m.
On Fri, May 03, 2013 at 12:37:14PM +0530, Srinidhi Kasagar wrote:
> On Thu, May 02, 2013 at 17:48:10 +0200, Lee Jones wrote:
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
> >         In function ‘synaptics_rmi4_resume’:
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
> >         warning: ignoring return value of ‘regulator_enable’, declared
> >         with attribute warn_unused_result [-Wunused-result
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: devel@driverdev.osuosl.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > index fe667dd..c4d013d 100644
> > --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
> >  	unsigned char intr_status;
> >  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
> >  
> > -	regulator_enable(rmi4_data->regulator);
> > +	retval = regulator_enable(rmi4_data->regulator);
> > +	if (retval < 0)
> > +		return retval;
> Does it make sense to add a dev_err?
> 

Is that a question?

regulator_enable() already prints some warnings.  Probably it's not
going to fail and adding code that is duplicative or will never be
run is pointless.

regards,
dan carpenter
Srinidhi Kasagar - May 6, 2013, 6:51 a.m.
On Sun, May 05, 2013 at 16:18:55 +0200, Dan Carpenter wrote:
> On Fri, May 03, 2013 at 12:37:14PM +0530, Srinidhi Kasagar wrote:
> > On Thu, May 02, 2013 at 17:48:10 +0200, Lee Jones wrote:
> > > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
> > >         In function ‘synaptics_rmi4_resume’:
> > > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
> > >         warning: ignoring return value of ‘regulator_enable’, declared
> > >         with attribute warn_unused_result [-Wunused-result
> > > 
> > > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > Cc: devel@driverdev.osuosl.org
> > > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > > ---
> > >  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > > index fe667dd..c4d013d 100644
> > > --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > > +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > > @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
> > >  	unsigned char intr_status;
> > >  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
> > >  
> > > -	regulator_enable(rmi4_data->regulator);
> > > +	retval = regulator_enable(rmi4_data->regulator);
> > > +	if (retval < 0)
> > > +		return retval;
> > Does it make sense to add a dev_err?
> > 
> 
> Is that a question?
> 
> regulator_enable() already prints some warnings.  Probably it's not
> going to fail and adding code that is duplicative or will never be
> run is pointless.

It has become a habit checking the return value and spit some errors.
And BTW, there are many drivers which does this way..Anyway if your
intention is to avoid them for the new drivers..I dont mind skipping
this..

regards/srinidhi


> 
> regards,
> dan carpenter
>
Dan Carpenter - May 6, 2013, 7:43 a.m.
On Mon, May 06, 2013 at 12:21:39PM +0530, Srinidhi Kasagar wrote:
> > > > -	regulator_enable(rmi4_data->regulator);
> > > > +	retval = regulator_enable(rmi4_data->regulator);
> > > > +	if (retval < 0)
> > > > +		return retval;
> > > Does it make sense to add a dev_err?
> > > 
> > 
> > Is that a question?
> > 
> > regulator_enable() already prints some warnings.  Probably it's not
> > going to fail and adding code that is duplicative or will never be
> > run is pointless.
> 
> It has become a habit checking the return value and spit some errors.
> And BTW, there are many drivers which does this way..Anyway if your
> intention is to avoid them for the new drivers..I dont mind skipping
> this..

It's not like I'm trying to ban error messages.  There isn't any
official policy on error messages.

regards,
dan carpenter
Lee Jones - May 14, 2013, 10:46 a.m.
Hi Greg,

> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
>         In function ‘synaptics_rmi4_resume’:
> drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
>         warning: ignoring return value of ‘regulator_enable’, declared
>         with attribute warn_unused_result [-Wunused-result
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: devel@driverdev.osuosl.org
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> index fe667dd..c4d013d 100644
> --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
>  	unsigned char intr_status;
>  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
>  
> -	regulator_enable(rmi4_data->regulator);
> +	retval = regulator_enable(rmi4_data->regulator);
> +	if (retval < 0)
> +		return retval;
>  
>  	enable_irq(rmi4_data->i2c_client->irq);
>  	rmi4_data->touch_stopped = false;

Are you planning to take this into the v3.10 -rcs?
Greg KH - May 14, 2013, 11:05 a.m.
On Tue, May 14, 2013 at 11:46:31AM +0100, Lee Jones wrote:
> Hi Greg,
> 
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:
> >         In function ‘synaptics_rmi4_resume’:
> > drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c:1090:18:
> >         warning: ignoring return value of ‘regulator_enable’, declared
> >         with attribute warn_unused_result [-Wunused-result
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Cc: devel@driverdev.osuosl.org
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
> > ---
> >  drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c |    4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > index fe667dd..c4d013d 100644
> > --- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > +++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
> > @@ -1087,7 +1087,9 @@ static int synaptics_rmi4_resume(struct device *dev)
> >  	unsigned char intr_status;
> >  	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
> >  
> > -	regulator_enable(rmi4_data->regulator);
> > +	retval = regulator_enable(rmi4_data->regulator);
> > +	if (retval < 0)
> > +		return retval;
> >  
> >  	enable_irq(rmi4_data->i2c_client->irq);
> >  	rmi4_data->touch_stopped = false;
> 
> Are you planning to take this into the v3.10 -rcs?

Yes, I was, give me some time to catch up on my pending patch queue (644
patches and counting).  Don't worry, it's not lost.

thanks,

greg k-h

Patch

diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
index fe667dd..c4d013d 100644
--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
@@ -1087,7 +1087,9 @@  static int synaptics_rmi4_resume(struct device *dev)
 	unsigned char intr_status;
 	struct synaptics_rmi4_data *rmi4_data = dev_get_drvdata(dev);
 
-	regulator_enable(rmi4_data->regulator);
+	retval = regulator_enable(rmi4_data->regulator);
+	if (retval < 0)
+		return retval;
 
 	enable_irq(rmi4_data->i2c_client->irq);
 	rmi4_data->touch_stopped = false;