Re: [PATCH] iio: magnetometer: fix if () scoped_guard() formatting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 8 Nov 2024 18:02:43 +0000
Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> wrote:

> On Fri,  8 Nov 2024 16:41:27 +0100
> Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx> wrote:
> 
> > From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > 
> > Add mising braces after an if condition that contains scoped_guard().
> > 
> > This style is both preferred and necessary here, to fix warning after
> > scoped_guard() change in commit fcc22ac5baf0 ("cleanup: Adjust
> > scoped_guard() macros to avoid potential warning") to have if-else inside
> > of the macro. Current (no braces) use in af8133j_set_scale() yields
> > the following warnings:
> > af8133j.c:315:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
> > af8133j.c:316:3: warning: add explicit braces to avoid dangling else [-Wdangling-else]
> > 
> > Fixes: fcc22ac5baf0 ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202409270848.tTpyEAR7-lkp@xxxxxxxxx/
> > Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
> > ---
> > I have forgot to add this patch prior to the cited Fixes: commit,
> > so Stephen Rothwell had to reinvent it, in order to fix linux-next.
> > original posting by Stephen Rothwell:
> > https://lore.kernel.org/lkml/20241028165336.7b46ce25@xxxxxxxxxxxxxxxx/
> > ---
> >  drivers/iio/magnetometer/af8133j.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/iio/magnetometer/af8133j.c b/drivers/iio/magnetometer/af8133j.c
> > index d81d89af6283..acd291f3e792 100644
> > --- a/drivers/iio/magnetometer/af8133j.c
> > +++ b/drivers/iio/magnetometer/af8133j.c
> > @@ -312,10 +312,11 @@ static int af8133j_set_scale(struct af8133j_data *data,
> >  	 * When suspended, just store the new range to data->range to be
> >  	 * applied later during power up.
> >  	 */
> > -	if (!pm_runtime_status_suspended(dev))
> > +	if (!pm_runtime_status_suspended(dev)) {  
> 
> I thought I replied to say don't do it this way. Ah well probably went astray
> as I was having some email issues yesterday.
> 
Also, for the fixes tag to make sense this will need got through the same tree as
that rather than IIO which doesn't have that commit yet.

Given timing I'm fine with this version getting picked up and if I care enough
I can chase it with a tidy up to the guard() form next cycle.  

Acked-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>


Jonathan

> 		guard(mutex)(&data->mutex);
> 		ret = regmap_write...
> 
> >  		scoped_guard(mutex, &data->mutex)
> >  			ret = regmap_write(data->regmap,
> >  					   AF8133J_REG_RANGE, range);
> > +	}
> >  
> >  	pm_runtime_enable(dev);
> >    
> 





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux