* [PATCH] media: staging: atomisp: remove unnecessary NULL checks in sensor drivers
@ 2025-12-12 12:38 Mikhail Dmitrichenko
2025-12-28 19:52 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Mikhail Dmitrichenko @ 2025-12-12 12:38 UTC (permalink / raw)
To: Hans de Goede
Cc: Mikhail Dmitrichenko, Mauro Carvalho Chehab, Sakari Ailus,
Andy Shevchenko, Greg Kroah-Hartman, Peter Zijlstra (Intel),
Thomas Andreatta, Josh Poimboeuf, Ingo Molnar, Alan Cox,
linux-media, linux-kernel, linux-staging, lvc-project
There are unnecessary NULL checks for v4l2_subdev_format::format
pointer in ov2722 and gc2235 sensor driver format operations.
The fmt pointer is derived from &format->format where format
is a pointer to an embedded struct v4l2_mbus_framefmt inside
struct v4l2_subdev_format, therefore fmt cannot be NULL.
Remove unnecessary NULL checks for v4l2_subdev_format::format
pointer to avoid unnecessary computations and make code
clearer.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko@astralinux.ru>
---
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c | 5 -----
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 4 ----
2 files changed, 9 deletions(-)
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
index 6050637a0def..98d43b93a3ba 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
@@ -535,8 +535,6 @@ static int gc2235_set_fmt(struct v4l2_subdev *sd,
return -EINVAL;
if (format->pad)
return -EINVAL;
- if (!fmt)
- return -EINVAL;
mutex_lock(&dev->input_lock);
res = v4l2_find_nearest_size(gc2235_res_preview,
@@ -577,9 +575,6 @@ static int gc2235_get_fmt(struct v4l2_subdev *sd,
if (format->pad)
return -EINVAL;
- if (!fmt)
- return -EINVAL;
-
fmt->width = dev->res->width;
fmt->height = dev->res->height;
fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
diff --git a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
index a4519babf37d..aaf30f072ad5 100644
--- a/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
+++ b/drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
@@ -635,8 +635,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd,
if (format->pad)
return -EINVAL;
- if (!fmt)
- return -EINVAL;
ov2722_info = v4l2_get_subdev_hostdata(sd);
if (!ov2722_info)
return -EINVAL;
@@ -705,8 +703,6 @@ static int ov2722_get_fmt(struct v4l2_subdev *sd,
if (format->pad)
return -EINVAL;
- if (!fmt)
- return -EINVAL;
fmt->width = dev->res->width;
fmt->height = dev->res->height;
--
2.39.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: staging: atomisp: remove unnecessary NULL checks in sensor drivers
2025-12-12 12:38 [PATCH] media: staging: atomisp: remove unnecessary NULL checks in sensor drivers Mikhail Dmitrichenko
@ 2025-12-28 19:52 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2025-12-28 19:52 UTC (permalink / raw)
To: Mikhail Dmitrichenko
Cc: Hans de Goede, Mauro Carvalho Chehab, Sakari Ailus,
Andy Shevchenko, Greg Kroah-Hartman, Peter Zijlstra (Intel),
Thomas Andreatta, Josh Poimboeuf, Ingo Molnar, Alan Cox,
linux-media, linux-kernel, linux-staging, lvc-project
On Fri, Dec 12, 2025 at 03:38:14PM +0300, Mikhail Dmitrichenko wrote:
> There are unnecessary NULL checks for v4l2_subdev_format::format
> pointer in ov2722 and gc2235 sensor driver format operations.
> The fmt pointer is derived from &format->format where format
> is a pointer to an embedded struct v4l2_mbus_framefmt inside
> struct v4l2_subdev_format, therefore fmt cannot be NULL.
>
> Remove unnecessary NULL checks for v4l2_subdev_format::format
> pointer to avoid unnecessary computations and make code
> clearer.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Sakari, can you pick this up?
> Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
This is not needed. There is no bug to test non-NULL pointer.
> Signed-off-by: Mikhail Dmitrichenko <mdmitrichenko@astralinux.ru>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-28 19:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-12 12:38 [PATCH] media: staging: atomisp: remove unnecessary NULL checks in sensor drivers Mikhail Dmitrichenko
2025-12-28 19:52 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).