Skip to contentSkip to conversation

media: i2c: Add imx334 camera sensor driver

bug report Dan Carpenter 1 participant 1 message Feb 9, 2021 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

Hello Martina Krasteva,

The patch 9746b11715c3: "media: i2c: Add imx334 camera sensor driver" from Feb 3, 2021, leads to the following static checker warning:

	drivers/media/i2c/imx334.c:721 imx334_set_stream()
	warn: pm_runtime_get_sync() also returns 1 on success

drivers/media/i2c/imx334.c
707 static int imx334_set_stream(struct v4l2_subdev *sd, int enable) 708 {
709 struct imx334 *imx334 = to_imx334(sd);
710 int ret;
711
712 mutex_lock(&imx334->mutex);
713
714 if (imx334->streaming == enable) {
715 mutex_unlock(&imx334->mutex);
716 return 0;
717 }
718
719 if (enable) {
720 ret = pm_runtime_get_sync(imx334->dev);
721 if (ret)

This needs to be: "if (ret < 0)"

   722                          goto error_power_off;
   723  
   724                  ret = imx334_start_streaming(imx334);
   725                  if (ret)
   726                          goto error_power_off;
   727          } else {
   728                  imx334_stop_streaming(imx334);
   729                  pm_runtime_put(imx334->dev);
   730          }
   731  
   732          imx334->streaming = enable;
   733  
   734          mutex_unlock(&imx334->mutex);
   735  
   736          return 0;
   737  
   738  error_power_off:
   739          pm_runtime_put(imx334->dev);
   740          mutex_unlock(&imx334->mutex);
   741  
   742          return ret;
   743  }

regards,
dan carpenter