aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarshit Mogalapalli <[email protected]>2023-07-18 07:06:58 -0700
committerHans Verkuil <[email protected]>2023-07-19 12:57:51 +0200
commit4b9fbbd58e35337d59431e988149930c1987dc30 (patch)
tree83a9cfe5a40e51cdf8003b704797f7d08db2d84e
parent37048e171cda6f000b97b4b4931659254db8f63d (diff)
media: i2c: ds90ub960: fix error handling in ub960_rxport_add_serializer()
Smatch warns: drivers/media/i2c/ds90ub960.c:1671 ub960_rxport_add_serializer(): err: 'rxport->ser.client' dereferencing possible ERR_PTR() i2c_new_client_device() returns error pointers on failure and in dev_dbg statement we are dereferencing error pointer which is a bug. Fix this by using IS_ERR() which checks for error pointers. Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver") Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
-rw-r--r--drivers/media/i2c/ds90ub960.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index e101bcf2356a..92aa004a3674 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -1662,10 +1662,10 @@ static int ub960_rxport_add_serializer(struct ub960_data *priv, u8 nport)
ser_info.addr = rxport->ser.alias;
rxport->ser.client =
i2c_new_client_device(priv->client->adapter, &ser_info);
- if (!rxport->ser.client) {
+ if (IS_ERR(rxport->ser.client)) {
dev_err(dev, "rx%u: cannot add %s i2c device", nport,
ser_info.type);
- return -EIO;
+ return PTR_ERR(rxport->ser.client);
}
dev_dbg(dev, "rx%u: remote serializer at alias 0x%02x (%u-%04x)\n",