Commit cc17afa2 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Mauro Carvalho Chehab

media: i2c: fix an uninitialized error code

Clang points out that the error handling in ov02a10_s_stream() is
broken, and just returns a random error code:

drivers/media/i2c/ov02a10.c:537:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
        if (ov02a10->streaming == on)
            ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov02a10.c:568:9: note: uninitialized use occurs here
        return ret;
               ^~~
drivers/media/i2c/ov02a10.c:537:2: note: remove the 'if' if its condition is always false
        if (ov02a10->streaming == on)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If streaming is already on, leave it that way and return success.
Suggested-by: default avatarDongchun Zhu <dongchun.zhu@mediatek.com>
Fixes: 91807efb ("media: i2c: add OV02A10 image sensor driver")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f0f54727
...@@ -534,8 +534,10 @@ static int ov02a10_s_stream(struct v4l2_subdev *sd, int on) ...@@ -534,8 +534,10 @@ static int ov02a10_s_stream(struct v4l2_subdev *sd, int on)
mutex_lock(&ov02a10->mutex); mutex_lock(&ov02a10->mutex);
if (ov02a10->streaming == on) if (ov02a10->streaming == on) {
ret = 0;
goto unlock_and_return; goto unlock_and_return;
}
if (on) { if (on) {
ret = pm_runtime_get_sync(&client->dev); ret = pm_runtime_get_sync(&client->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment