[bug report] staging/atomisp: Add support for the Intel IPU v2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Alan Cox,

The patch a49d25364dfb: "staging/atomisp: Add support for the Intel
IPU v2" from Feb 17, 2017, leads to the following static checker
warning:

	drivers/staging/media/atomisp/i2c/imx/imx.c:498 imx_set_exposure_gain()
	warn: inconsistent returns 'mutex:&dev->input_lock'.

drivers/staging/media/atomisp/i2c/imx/imx.c
   438  static int imx_set_exposure_gain(struct v4l2_subdev *sd, u16 coarse_itg,
   439          u16 gain, u16 digitgain)
   440  {
   441          struct imx_device *dev = to_imx_sensor(sd);
   442          struct i2c_client *client = v4l2_get_subdevdata(sd);
   443          int lanes = imx_get_lanes(sd);
   444          unsigned int digitgain_scaled;
   445          int ret = 0;
   446  
   447          /* Validate exposure:  cannot exceed VTS-4 where VTS is 16bit */
   448          coarse_itg = clamp_t(u16, coarse_itg, 0, IMX_MAX_EXPOSURE_SUPPORTED);
   449  
   450          /* Validate gain: must not exceed maximum 8bit value */
   451          gain = clamp_t(u16, gain, 0, IMX_MAX_GLOBAL_GAIN_SUPPORTED);
   452  
   453          mutex_lock(&dev->input_lock);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   454  
   455          if (dev->sensor_id == IMX227_ID) {
   456                  ret = imx_write_reg_array(client, imx_param_hold);
   457                  if (ret)
   458                          return ret;
				^^^^^^^^^^
We're returning directly with the lock held.  We should either unlock
before returning or do a goto out but I'm not sure which.

   459          }
   460  
   461          /* For imx175, setting gain must be delayed by one */
   462          if ((dev->sensor_id == IMX175_ID) && dev->digital_gain)
   463                  digitgain_scaled = dev->digital_gain;
   464          else
   465                  digitgain_scaled = digitgain;
   466          /* imx132 with two lanes needs more gain to saturate at max */
   467          if (dev->sensor_id == IMX132_ID && lanes > 1) {
   468                  digitgain_scaled *= IMX132_2LANES_GAINFACT;
   469                  digitgain_scaled >>= IMX132_2LANES_GAINFACT_SHIFT;
   470          }
   471          /* Validate digital gain: must not exceed 12 bit value*/
   472          digitgain_scaled = clamp_t(unsigned int, digitgain_scaled,
   473                                     0, IMX_MAX_DIGITAL_GAIN_SUPPORTED);
   474  
   475          ret = __imx_update_exposure_timing(client, coarse_itg,
   476                          dev->pixels_per_line, dev->lines_per_frame);
   477          if (ret)
   478                  goto out;
   479          dev->coarse_itg = coarse_itg;
   480  
   481          if (dev->sensor_id == IMX175_ID)
   482                  ret = __imx_update_gain(sd, dev->gain);
   483          else
   484                  ret = __imx_update_gain(sd, gain);
   485          if (ret)
   486                  goto out;
   487          dev->gain = gain;
   488  
   489          ret = __imx_update_digital_gain(client, digitgain_scaled);
   490          if (ret)
   491                  goto out;
   492          dev->digital_gain = digitgain;
   493  
   494  out:
   495          if (dev->sensor_id == IMX227_ID)
   496                  ret = imx_write_reg_array(client, imx_param_update);
   497          mutex_unlock(&dev->input_lock);
   498          return ret;
   499  }

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux