[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZLaanLVc22iKg/xV@smile.fi.intel.com>
Date: Tue, 18 Jul 2023 16:58:52 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
Cc: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org,
error27@...il.com
Subject: Re: [PATCH next] media: i2c: fix error handling in
ub960_rxport_add_serializer()
On Tue, Jul 18, 2023 at 01:58:46AM -0700, Harshit Mogalapalli wrote:
> 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.
...
> - 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;
It should be changed to return PTR_ERR(...);
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists