[PATCH] media: atomisp: Use negation to check for NULL

Gabriel Sanches posted 1 patch 1 month, 3 weeks ago
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] media: atomisp: Use negation to check for NULL
Posted by Gabriel Sanches 1 month, 3 weeks ago
Fix checkpath error 'CHECK: Comparison to NULL could be written
"!gmin_subdevs[i].subdev"' in atomisp_gmin_platform.c:650.

Signed-off-by: Gabriel Sanches <gabriel@gsr.dev>
---

Hey, this is my first patch ever. I would appreciate any
feedback. Thanks!
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index 4026e98c5845..620924614ee3 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -647,7 +647,7 @@ static struct gmin_subdev *find_free_gmin_subdev_slot(void)
 	unsigned int i;
 
 	for (i = 0; i < MAX_SUBDEVS; i++)
-		if (gmin_subdevs[i].subdev == NULL)
+		if (!gmin_subdevs[i].subdev)
 			return &gmin_subdevs[i];
 	return NULL;
 }
-- 
2.52.0
Re: [PATCH] media: atomisp: Use negation to check for NULL
Posted by Andy Shevchenko 1 month, 3 weeks ago
On Thu, Apr 23, 2026 at 03:14:36PM -0300, Gabriel Sanches wrote:

...

> Hey, this is my first patch ever. I would appreciate any
> feedback. Thanks!

Please, start reviewing others' patches for the same driver and read other
reviews and learn from them first.

I'm not going to repeat what I said already several times on a patches like
this over the very same driver (atomisp).

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] media: atomisp: Use negation to check for NULL
Posted by Helen Koike 1 month, 2 weeks ago
Hi Gabriel,

Thanks for your patch, please see my comments below.

On 4/23/26 3:14 PM, Gabriel Sanches wrote:
 > Fix checkpath error 'CHECK: Comparison to NULL could be written

typo: checkpatch.

On 4/24/26 5:54 AM, Andy Shevchenko wrote:
> On Thu, Apr 23, 2026 at 03:14:36PM -0300, Gabriel Sanches wrote:
> 
> ...
> 
>> Hey, this is my first patch ever. I would appreciate any
>> feedback. Thanks!
> 
> Please, start reviewing others' patches for the same driver and read other
> reviews and learn from them first.

Gabriel, fyi, you can check previous reviews on this driver on 
lore.kernel.org, for instance: https://lore.kernel.org/all/?q=atomisp

> 
> I'm not going to repeat what I said already several times on a patches like
> this over the very same driver (atomisp).
> 

You can see in the previous reviews a few comments to not fix just a 
single occurrence of the issue on the driver, but to fix in a set of 
files or in the entire driver.

By running checkpatch recursively on the entire driver, I found 5 
occurrences of this same problem.

You can check with:

   find drivers/staging/media/atomisp -name "*.c" -o -name "*.h" \
     | xargs scripts/checkpatch.pl -f 2>&1 \
     | grep -A3 "Comparison to NULL"

I hope this helps.

Regards,
Helen