Re: [PATCH] hmc5843_i2c.c: fix missing return value check of devm_regmap_init_i2c()

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

 



On Sun, Aug 19, 2018 at 10:16:41AM +0800, Jiecheng Wu wrote:
> Function hmc5843_i2c_probe() defined in
>  drivers/iio/magnetometer/hmc5843_i2c.c calls devm_regmap_init_i2c()
>  to initialise managed register map. As the return value of
>  devm_regmap_init_i2c() will be an ERR_PTR() on error, the return
>  value must be checked against NULL.

Please take a careful look again at what points I suggested
in a previous patch you sent.

Take a look at a sample patch:
https://lore.kernel.org/lkml/20180531112107.13778-1-hdegoede@xxxxxxxxxx/

* Signed-off-by:
* Bugzilla link:
* Send to relevant maintainers:
himanshu@himanshu-Vostro-3559:~/linux-next$ ./scripts/get_maintainer.pl ~/Downloads/hmc5843_i2c.c-fix-missing-return-value-check-of-devm_regmap_init_i2c.patch

	Jonathan Cameron <jic23@xxxxxxxxxx> (maintainer:IIO SUBSYSTEM AND DRIVERS)
	Hartmut Knaack <knaack.h@xxxxxx> (reviewer:IIO SUBSYSTEM AND DRIVERS)
	Lars-Peter Clausen <lars@xxxxxxxxxx> (reviewer:IIO SUBSYSTEM AND DRIVERS)
	Peter Meerwald-Stadler <pmeerw@xxxxxxxxxx> (reviewer:IIO SUBSYSTEM AND DRIVERS)
	linux-iio@xxxxxxxxxxxxxxx (open list:IIO SUBSYSTEM AND DRIVERS)
	linux-kernel@xxxxxxxxxxxxxxx (open list)
* cc stable
* Fixes tag: -- would be helpful
* correct version numbering with changelog below the '---' (v1->v2->3 ...)

All these are documented here:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

> ---
>  drivers/iio/magnetometer/hmc5843_i2c.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c
> index 3de7f44..4911cf8 100644
> --- a/drivers/iio/magnetometer/hmc5843_i2c.c
> +++ b/drivers/iio/magnetometer/hmc5843_i2c.c
> @@ -14,6 +14,7 @@
>  #include <linux/regmap.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/triggered_buffer.h>
> +#include <linux/device.h>

This include is not required since #include <linux/iio/iio.h>
already includes it.

-- 
Himanshu Jha
Undergraduate Student
Department of Electronics & Communication
Guru Tegh Bahadur Institute of Technology



[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