[13/17] media: i2c: ov7670: 0 instead of -EINVAL was returned

Message ID 20230126150657.367921-14-hverkuil-cisco@xs4all.nl (mailing list archive)
State Accepted
Delegated to: Hans Verkuil
Headers
Series media: sparse/smatch fixes |

Commit Message

Hans Verkuil Jan. 26, 2023, 3:06 p.m. UTC
  If the media bus is unsupported, then return -EINVAL. Instead it
returned 'ret' which happened to be 0.

This fixes a smatch warning:

ov7670.c:1843 ov7670_parse_dt() warn: missing error code? 'ret'

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/i2c/ov7670.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Sakari Ailus Jan. 26, 2023, 9:44 p.m. UTC | #1
Hi Hans,

On Thu, Jan 26, 2023 at 04:06:53PM +0100, Hans Verkuil wrote:
> If the media bus is unsupported, then return -EINVAL. Instead it
> returned 'ret' which happened to be 0.
> 
> This fixes a smatch warning:
> 
> ov7670.c:1843 ov7670_parse_dt() warn: missing error code? 'ret'
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>

Thanks for the fix.

Could you add:

Fixes: 01b8444828fc ("media: v4l2: i2c: ov7670: Implement OF mbus configuration")
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
  

Patch

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index 27db0a07de1f..b1bb0833571e 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -1840,7 +1840,7 @@  static int ov7670_parse_dt(struct device *dev,
 
 	if (bus_cfg.bus_type != V4L2_MBUS_PARALLEL) {
 		dev_err(dev, "Unsupported media bus type\n");
-		return ret;
+		return -EINVAL;
 	}
 	info->mbus_config = bus_cfg.bus.parallel.flags;