[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1633674573-81211-1-git-send-email-jiasheng@iscas.ac.cn>
Date: Fri, 8 Oct 2021 06:29:33 +0000
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: jbhayana@...gle.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] iio/scmi: check if dev is null pointer
The parameter 'dev' of scmi_iio_dev_probe() isn't been
checked before used, including when scmi_iio_dev_probe() is called.
Therefore, it might be better to check, just in case.
Fixes: 25cbdd4 ("iio/scmi: Port driver to the new scmi_sensor_proto_ops interface")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/iio/common/scmi_sensors/scmi_iio.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c
index 141e8aa..d3ff985 100644
--- a/drivers/iio/common/scmi_sensors/scmi_iio.c
+++ b/drivers/iio/common/scmi_sensors/scmi_iio.c
@@ -592,6 +592,9 @@ static int scmi_iio_dev_probe(struct scmi_device *sdev)
if (!handle)
return -ENODEV;
+
+ if (!dev)
+ return -ENODEV;
sensor_ops = handle->devm_protocol_get(sdev, SCMI_PROTOCOL_SENSOR, &ph);
if (IS_ERR(sensor_ops)) {
--
2.7.4
Powered by blists - more mailing lists