[1/2] iio: adc: ti-ads1298: Fix error code in probe()

Message ID 5f393a87-ca8b-4e68-a6f4-a79f75a91ccb@moroto.mountain
State New
Headers
Series [1/2] iio: adc: ti-ads1298: Fix error code in probe() |

Commit Message

Dan Carpenter Feb. 22, 2024, 6:14 a.m. UTC
  There is a copy and paste bug here, it should be "reg_vref" instead of
"reg_avdd".  The "priv->reg_avdd" variable is zero so it ends up
returning success.

Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/iio/adc/ti-ads1298.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Mike Looijmans Feb. 22, 2024, 7:10 a.m. UTC | #1
Good catch on both patches.

If so desired, you have my

Acked-by: Mike Looijmans <mike.looijmans@topic.nl>



On 22-02-2024 07:14, Dan Carpenter wrote:
> There is a copy and paste bug here, it should be "reg_vref" instead of
> "reg_avdd".  The "priv->reg_avdd" variable is zero so it ends up
> returning success.
>
> Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/iio/adc/ti-ads1298.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/ti-ads1298.c b/drivers/iio/adc/ti-ads1298.c
> index ed895a30beed..67637f1abdc7 100644
> --- a/drivers/iio/adc/ti-ads1298.c
> +++ b/drivers/iio/adc/ti-ads1298.c
> @@ -657,7 +657,7 @@ static int ads1298_probe(struct spi_device *spi)
>   	priv->reg_vref = devm_regulator_get_optional(dev, "vref");
>   	if (IS_ERR(priv->reg_vref)) {
>   		if (PTR_ERR(priv->reg_vref) != -ENODEV)
> -			return dev_err_probe(dev, PTR_ERR(priv->reg_avdd),
> +			return dev_err_probe(dev, PTR_ERR(priv->reg_vref),
>   					     "Failed to get vref regulator\n");
>   
>   		priv->reg_vref = NULL;
  
Jonathan Cameron Feb. 24, 2024, 6:13 p.m. UTC | #2
On Thu, 22 Feb 2024 08:10:25 +0100
Mike Looijmans <mike.looijmans@topic.nl> wrote:

> Good catch on both patches.
> 
> If so desired, you have my
> 
> Acked-by: Mike Looijmans <mike.looijmans@topic.nl>

Dan, here is a classic example of why I think any series with more than
1 patch could benefit from a cover letter. It gives somewhere for
reviewers to give tags for the lot in a fashion b4 can understand.

Otherwise great find and applied to the togreg branch of iio.git
with Mike's tag added to both of them!  Hopefully the fixes tags will
remain stable - whilst in theory that tree doesn't get rebased, in practice
it might if I messed anything up enough :( 

Thanks

Jonathan


> 
> 
> 
> On 22-02-2024 07:14, Dan Carpenter wrote:
> > There is a copy and paste bug here, it should be "reg_vref" instead of
> > "reg_avdd".  The "priv->reg_avdd" variable is zero so it ends up
> > returning success.
> >
> > Fixes: 00ef7708fa60 ("iio: adc: ti-ads1298: Add driver")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> >   drivers/iio/adc/ti-ads1298.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/ti-ads1298.c b/drivers/iio/adc/ti-ads1298.c
> > index ed895a30beed..67637f1abdc7 100644
> > --- a/drivers/iio/adc/ti-ads1298.c
> > +++ b/drivers/iio/adc/ti-ads1298.c
> > @@ -657,7 +657,7 @@ static int ads1298_probe(struct spi_device *spi)
> >   	priv->reg_vref = devm_regulator_get_optional(dev, "vref");
> >   	if (IS_ERR(priv->reg_vref)) {
> >   		if (PTR_ERR(priv->reg_vref) != -ENODEV)
> > -			return dev_err_probe(dev, PTR_ERR(priv->reg_avdd),
> > +			return dev_err_probe(dev, PTR_ERR(priv->reg_vref),
> >   					     "Failed to get vref regulator\n");
> >   
> >   		priv->reg_vref = NULL;  
> 
>
  
Dan Carpenter Feb. 26, 2024, 7:45 a.m. UTC | #3
On Sat, Feb 24, 2024 at 06:13:54PM +0000, Jonathan Cameron wrote:
> On Thu, 22 Feb 2024 08:10:25 +0100
> Mike Looijmans <mike.looijmans@topic.nl> wrote:
> 
> > Good catch on both patches.
> > 
> > If so desired, you have my
> > 
> > Acked-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> Dan, here is a classic example of why I think any series with more than
> 1 patch could benefit from a cover letter. It gives somewhere for
> reviewers to give tags for the lot in a fashion b4 can understand.
> 
> Otherwise great find and applied to the togreg branch of iio.git
> with Mike's tag added to both of them!  Hopefully the fixes tags will
> remain stable - whilst in theory that tree doesn't get rebased, in practice
> it might if I messed anything up enough :( 

Sure.  I can start writing cover letters.

regards,
dan carpenter
  
Andy Shevchenko Feb. 26, 2024, 2:37 p.m. UTC | #4
On Sat, Feb 24, 2024 at 06:13:54PM +0000, Jonathan Cameron wrote:
> On Thu, 22 Feb 2024 08:10:25 +0100
> Mike Looijmans <mike.looijmans@topic.nl> wrote:
> 
> > Good catch on both patches.
> > 
> > If so desired, you have my
> > 
> > Acked-by: Mike Looijmans <mike.looijmans@topic.nl>
> 
> Dan, here is a classic example of why I think any series with more than
> 1 patch could benefit from a cover letter. It gives somewhere for
> reviewers to give tags for the lot in a fashion b4 can understand.
> 
> Otherwise great find and applied to the togreg branch of iio.git
> with Mike's tag added to both of them!  Hopefully the fixes tags will
> remain stable - whilst in theory that tree doesn't get rebased, in practice
> it might if I messed anything up enough :( 

I even added this to be automatically done when I use my script [1].
Dunno if b4 relay (or what is there to send patch series?) can handle
that.

[1]: https://github.com/andy-shev/home-bin-tools/blob/master/ge2maintainer.sh
  

Patch

diff --git a/drivers/iio/adc/ti-ads1298.c b/drivers/iio/adc/ti-ads1298.c
index ed895a30beed..67637f1abdc7 100644
--- a/drivers/iio/adc/ti-ads1298.c
+++ b/drivers/iio/adc/ti-ads1298.c
@@ -657,7 +657,7 @@  static int ads1298_probe(struct spi_device *spi)
 	priv->reg_vref = devm_regulator_get_optional(dev, "vref");
 	if (IS_ERR(priv->reg_vref)) {
 		if (PTR_ERR(priv->reg_vref) != -ENODEV)
-			return dev_err_probe(dev, PTR_ERR(priv->reg_avdd),
+			return dev_err_probe(dev, PTR_ERR(priv->reg_vref),
 					     "Failed to get vref regulator\n");
 
 		priv->reg_vref = NULL;