Skip to contentSkip to conversation

media: i2c: ov02a10: fix an uninitialized return

PATCH In review Dan Carpenter 4 participants 5 messages Dec 7, 2020

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: ov02a10: fix an uninitialized return

The "ret" variable isn't set on the no-op path where we are setting to on/off and it's in the on or off state already.

Fixes 91807efbe8ec ("media: i2c: add OV02A10 image sensor driver")
---
 drivers/media/i2c/ov02a10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ov02a10.c +1 -1
index 391718136ade..cf40e207ea21 100644
@@ -530,7 +530,7 @@ static int ov02a10_s_stream(struct v4l2_subdev *sd, int on)
 {
 	struct ov02a10 *ov02a10 = to_ov02a10(sd);
 	struct i2c_client *client = v4l2_get_subdevdata(&ov02a10->subdev);
-	int ret;
+	int ret = 0;
 
 	mutex_lock(&ov02a10->mutex);
 
Signature · 1 line
2.29.2
maintainer
#1 lore raw

Hi Dan,

Quoted 5 lines · Dan Carpenter

The "ret" variable isn't set on the no-op path where we are setting to on/off and it's in the on or off state already.

Fixes 91807efbe8ec ("media: i2c: add OV02A10 image sensor driver")

Thanks for the patch.

This issue has been fixed by another patch here:

<URL:https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/>

Signature · 3 lines
Kind regards,

Sakari Ailus
#2 lore raw
In reply to Dan Carpenter

+Cc: some people who involved in different kernel source checkers

Quoted 4 lines · Sakari Ailus
Quoted 3 lines · Dan Carpenter

The "ret" variable isn't set on the no-op path where we are setting to on/off and it's in the on or off state already.

Quoted 8 lines
Quoted 2 lines
Fixes 91807efbe8ec ("media: i2c: add OV02A10 image sensor driver")

Thanks for the patch.

This issue has been fixed by another patch here:

<URL:https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/>

This has been reported by 3 or 4 different people. I'm wondering if it's possible to introduce a common database to somehow reduce the amount of patches against the same findings.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw
Quoted 14 lines · Andy Shevchenko

+Cc: some people who involved in different kernel source checkers

Quoted 9 lines · Sakari Ailus
Quoted 5 lines · Dan Carpenter

The "ret" variable isn't set on the no-op path where we are setting to on/off and it's in the on or off state already.

Fixes 91807efbe8ec ("media: i2c: add OV02A10 image sensor driver")

Thanks for the patch.

Quoted 7 lines
Quoted 3 lines

This issue has been fixed by another patch here:

<URL:https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/>

This has been reported by 3 or 4 different people. I'm wondering if it's possible to introduce a common database to somehow reduce the amount of patches against the same findings.

+workflows and kernelci re multiple reports/patches for the same kernel bug

I think KernelCI DB effort has a goal of fighting this duplication of efforts. But as far as I understand the exact mechanism for deduplication is an open question.

#4 lore raw
In reply to Dan Carpenter
Quoted 13 lines · Andy Shevchenko

+Cc: some people who involved in different kernel source checkers

Quoted 9 lines · Sakari Ailus
Quoted 5 lines · Dan Carpenter

The "ret" variable isn't set on the no-op path where we are setting to on/off and it's in the on or off state already.

Fixes 91807efbe8ec ("media: i2c: add OV02A10 image sensor driver")

Thanks for the patch.

Quoted 7 lines
Quoted 3 lines

This issue has been fixed by another patch here:

<URL:https://patchwork.linuxtv.org/project/linux-media/patch/[email protected]/>

This has been reported by 3 or 4 different people. I'm wondering if it's possible to introduce a common database to somehow reduce the amount of patches against the same findings.

Tell your devs to stop introducing bugs... :P This is your punishment.

Linus turned off GCC warnings for uninitialized variables earlier this year. He got annoyed because it doesn't work half the time depending on the version and optimization level. I sort of disagree with that, because I reporting these bugs is taking up a lot of my time. It has definitely gotten worse from my perspective.

The best solution would be for the original developer to run Smatch on their code. Another option would be to make a script where you give it a function name and it searches patches within the last week on lore.kernel.org

regards,
dan carpenter