[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220612125213.dguu4wj2mk6373sk@CAB-WSD-L081021.sigma.sbrf.ru>
Date: Sun, 12 Jun 2022 12:51:34 +0000
From: Dmitry Rokosov <DDRokosov@...rdevices.ru>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
CC: "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"jic23@...nel.org" <jic23@...nel.org>,
kernel <kernel@...rdevices.ru>,
"lars@...afoo.de" <lars@...afoo.de>,
"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"stano.jakubek@...il.com" <stano.jakubek@...il.com>,
"stephan@...hold.net" <stephan@...hold.net>
Subject: Re: [PATCH v2 2/3] iio: add MEMSensing MSA311 3-axis accelerometer
driver
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
Powered by blists - more mailing lists