[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1633663260-71997-1-git-send-email-jiasheng@iscas.ac.cn>
Date: Fri, 8 Oct 2021 03:21:00 +0000
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: lorenzo.bianconi83@...il.com, jic23@...nel.org, lars@...afoo.de
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] io: imu: st_lsm6dsx: check if dev is null pointer
The parameter 'dev' of st_lsm6dsx_probe() isn't been
checked before used, including when st_lsm6dsx_probe() is called.
Therefore, it might be better to check, just in case.
Fixes: 290a6ce ("iio: imu: add support to lsm6dsx driver")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index 7cedaab..7b4754d 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2199,6 +2199,8 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
const char *name = NULL;
int i, err;
+ if (!dev)
+ return -ENOMEM;
hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
if (!hw)
return -ENOMEM;
--
2.7.4
Powered by blists - more mailing lists