lkml.org 
[lkml]   [2022]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v2 2/3] iio: add MEMSensing MSA311 3-axis accelerometer driver
Date
Hello Christophe,

On Sun, Jun 12, 2022 at 11:46:19AM +0200, Christophe JAILLET wrote:
> Le 25/05/2022 à 20:15, Dmitry Rokosov a écrit :
> > +static int msa311_probe(struct i2c_client *i2c)
> > +{
> > + struct msa311_priv *msa311;
> > + struct iio_dev *indio_dev;
> > + struct device *dev = &i2c->dev;
> > + int err;
> > +
> > + indio_dev = devm_iio_device_alloc(dev, sizeof(*msa311));
> > + if (!indio_dev)
> > + return dev_err_probe(dev, -ENOMEM,
> > + "iio device allocation failed\n");
> > +
> > + msa311 = iio_priv(indio_dev);
> > + msa311->i2c = i2c;
> > + i2c_set_clientdata(i2c, indio_dev);
> > +
> > + err = msa311_regmap_init(msa311);
> > + if (err)
> > + return err;
> > +
> > + mutex_init(&msa311->lock);
> > +
> > + err = devm_pm_runtime_enable(dev);
> > + if (err)
> > + return dev_err_probe(dev, err,
> > + "cannot enable runtime PM (%d)\n", err);
> > +
>
> Nit: dev_err_probe() already print the 'err' (in a human readable maner), so
> unless the code itself is of any interest, it can be removed:
>
> i.e.:
> + return dev_err_probe(dev, err,
> + "cannot enable runtime PM");
>
> This pattern is used in many places.

Thank you for pointing this! It's a really helpful dev_err_probe() trait.
I'll use it in the v3 patchset.

--
Thank you,
Dmitry
\
 
 \ /
  Last update: 2022-06-12 14:52    [W:0.272 / U:1.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site