CC: [email protected]
TO: Sowjanya Komatineni <[email protected]>
CC: Hans Verkuil <[email protected]>

tree:   git://linuxtv.org/hverkuil/media_tree.git tegrav4
head:   ce1e7ce798ee872c0cd58f0a98a1f4db0606f8a2
commit: 8e6137f211b496f99153e409c92f7a5ce3c9dbf3 [22/25] media: i2c: Add 
support for IMX274 supplies and external clock
:::::: branch date: 9 days ago
:::::: commit date: 9 days ago
config: i386-randconfig-m021-20200825 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

smatch warnings:
drivers/media/i2c/imx274.c:1864 imx274_probe() error: uninitialized symbol 
'ret'.

git remote add hverkuil-media git://linuxtv.org/hverkuil/media_tree.git
git fetch --no-tags hverkuil-media tegrav4
git checkout 8e6137f211b496f99153e409c92f7a5ce3c9dbf3
vim +/ret +1864 drivers/media/i2c/imx274.c

0985dd306f727d Leon Luo            2017-10-05  1847  
e671499303e4c0 Kieran Bingham      2019-07-10  1848  static int 
imx274_probe(struct i2c_client *client)
0985dd306f727d Leon Luo            2017-10-05  1849  {
0985dd306f727d Leon Luo            2017-10-05  1850     struct v4l2_subdev *sd;
0985dd306f727d Leon Luo            2017-10-05  1851     struct stimx274 *imx274;
0985dd306f727d Leon Luo            2017-10-05  1852     int ret;
0985dd306f727d Leon Luo            2017-10-05  1853  
0985dd306f727d Leon Luo            2017-10-05  1854     /* initialize imx274 */
0985dd306f727d Leon Luo            2017-10-05  1855     imx274 = 
devm_kzalloc(&client->dev, sizeof(*imx274), GFP_KERNEL);
0985dd306f727d Leon Luo            2017-10-05  1856     if (!imx274)
0985dd306f727d Leon Luo            2017-10-05  1857             return -ENOMEM;
0985dd306f727d Leon Luo            2017-10-05  1858  
0985dd306f727d Leon Luo            2017-10-05  1859     
mutex_init(&imx274->lock);
0985dd306f727d Leon Luo            2017-10-05  1860  
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1861     imx274->xclk = 
devm_clk_get(&client->dev, "xclk");
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1862     if 
(IS_ERR(imx274->xclk)) {
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1863             
dev_err(&client->dev, "Failed to get xclk\n");
8e6137f211b496 Sowjanya Komatineni 2020-06-03 @1864             return ret;
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1865     }
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1866  
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1867     ret = 
clk_set_rate(imx274->xclk, IMX274_DEFAULT_CLK_FREQ);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1868     if (ret < 0) {
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1869             
dev_err(&client->dev, "Failed to set xclk rate\n");
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1870             return ret;
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1871     }
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1872  
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1873     ret = 
imx274_get_regulators(&client->dev, imx274);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1874     if (ret) {
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1875             
dev_err(&client->dev, "Failed to get power regulators, err: %d\n", ret);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1876             return ret;
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1877     }
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1878  
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1879     /* initialize format */
9648cb577b76ec Luca Ceresoli       2018-08-24  1880     imx274->mode = 
&imx274_modes[IMX274_DEFAULT_BINNING];
39dd23dc9d4c51 Luca Ceresoli       2018-07-25  1881     imx274->crop.width = 
IMX274_MAX_WIDTH;
39dd23dc9d4c51 Luca Ceresoli       2018-07-25  1882     imx274->crop.height = 
IMX274_MAX_HEIGHT;
39dd23dc9d4c51 Luca Ceresoli       2018-07-25  1883     imx274->format.width = 
imx274->crop.width / imx274->mode->bin_ratio;
39dd23dc9d4c51 Luca Ceresoli       2018-07-25  1884     imx274->format.height = 
imx274->crop.height / imx274->mode->bin_ratio;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1885     imx274->format.field = 
V4L2_FIELD_NONE;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1886     imx274->format.code = 
MEDIA_BUS_FMT_SRGGB10_1X10;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1887     
imx274->format.colorspace = V4L2_COLORSPACE_SRGB;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1888     
imx274->frame_interval.numerator = 1;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1889     
imx274->frame_interval.denominator = IMX274_DEF_FRAME_RATE;
438ac1fd5e1e13 Luca Ceresoli       2018-06-11  1890  
0985dd306f727d Leon Luo            2017-10-05  1891     /* initialize regmap */
0985dd306f727d Leon Luo            2017-10-05  1892     imx274->regmap = 
devm_regmap_init_i2c(client, &imx274_regmap_config);
0985dd306f727d Leon Luo            2017-10-05  1893     if 
(IS_ERR(imx274->regmap)) {
0985dd306f727d Leon Luo            2017-10-05  1894             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1895                     "regmap 
init failed: %ld\n", PTR_ERR(imx274->regmap));
0985dd306f727d Leon Luo            2017-10-05  1896             ret = -ENODEV;
0985dd306f727d Leon Luo            2017-10-05  1897             goto err_regmap;
0985dd306f727d Leon Luo            2017-10-05  1898     }
0985dd306f727d Leon Luo            2017-10-05  1899  
0985dd306f727d Leon Luo            2017-10-05  1900     /* initialize subdevice 
*/
0985dd306f727d Leon Luo            2017-10-05  1901     imx274->client = client;
0985dd306f727d Leon Luo            2017-10-05  1902     sd = &imx274->sd;
0985dd306f727d Leon Luo            2017-10-05  1903     
v4l2_i2c_subdev_init(sd, client, &imx274_subdev_ops);
0985dd306f727d Leon Luo            2017-10-05  1904     sd->flags |= 
V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
0985dd306f727d Leon Luo            2017-10-05  1905  
0985dd306f727d Leon Luo            2017-10-05  1906     /* initialize subdev 
media pad */
0985dd306f727d Leon Luo            2017-10-05  1907     imx274->pad.flags = 
MEDIA_PAD_FL_SOURCE;
0985dd306f727d Leon Luo            2017-10-05  1908     sd->entity.function = 
MEDIA_ENT_F_CAM_SENSOR;
0985dd306f727d Leon Luo            2017-10-05  1909     ret = 
media_entity_pads_init(&sd->entity, 1, &imx274->pad);
0985dd306f727d Leon Luo            2017-10-05  1910     if (ret < 0) {
0985dd306f727d Leon Luo            2017-10-05  1911             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1912                     "%s : 
media entity init Failed %d\n", __func__, ret);
0985dd306f727d Leon Luo            2017-10-05  1913             goto err_regmap;
0985dd306f727d Leon Luo            2017-10-05  1914     }
0985dd306f727d Leon Luo            2017-10-05  1915  
0985dd306f727d Leon Luo            2017-10-05  1916     /* initialize sensor 
reset gpio */
0985dd306f727d Leon Luo            2017-10-05  1917     imx274->reset_gpio = 
devm_gpiod_get_optional(&client->dev, "reset",
0985dd306f727d Leon Luo            2017-10-05  1918                             
                     GPIOD_OUT_HIGH);
0985dd306f727d Leon Luo            2017-10-05  1919     if 
(IS_ERR(imx274->reset_gpio)) {
0985dd306f727d Leon Luo            2017-10-05  1920             if 
(PTR_ERR(imx274->reset_gpio) != -EPROBE_DEFER)
0985dd306f727d Leon Luo            2017-10-05  1921                     
dev_err(&client->dev, "Reset GPIO not setup in DT");
0985dd306f727d Leon Luo            2017-10-05  1922             ret = 
PTR_ERR(imx274->reset_gpio);
0985dd306f727d Leon Luo            2017-10-05  1923             goto err_me;
0985dd306f727d Leon Luo            2017-10-05  1924     }
0985dd306f727d Leon Luo            2017-10-05  1925  
0985dd306f727d Leon Luo            2017-10-05  1926     /* initialize controls 
*/
82f5b507c0cf35 Luca Ceresoli       2018-11-27  1927     ret = 
v4l2_ctrl_handler_init(&imx274->ctrls.handler, 4);
0985dd306f727d Leon Luo            2017-10-05  1928     if (ret < 0) {
0985dd306f727d Leon Luo            2017-10-05  1929             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1930                     "%s : 
ctrl handler init Failed\n", __func__);
0985dd306f727d Leon Luo            2017-10-05  1931             goto err_me;
0985dd306f727d Leon Luo            2017-10-05  1932     }
0985dd306f727d Leon Luo            2017-10-05  1933  
0985dd306f727d Leon Luo            2017-10-05  1934     
imx274->ctrls.handler.lock = &imx274->lock;
0985dd306f727d Leon Luo            2017-10-05  1935  
0985dd306f727d Leon Luo            2017-10-05  1936     /* add new controls */
0985dd306f727d Leon Luo            2017-10-05  1937     
imx274->ctrls.test_pattern = v4l2_ctrl_new_std_menu_items(
0985dd306f727d Leon Luo            2017-10-05  1938             
&imx274->ctrls.handler, &imx274_ctrl_ops,
0985dd306f727d Leon Luo            2017-10-05  1939             
V4L2_CID_TEST_PATTERN,
0985dd306f727d Leon Luo            2017-10-05  1940             
ARRAY_SIZE(tp_qmenu) - 1, 0, 0, tp_qmenu);
0985dd306f727d Leon Luo            2017-10-05  1941  
0985dd306f727d Leon Luo            2017-10-05  1942     imx274->ctrls.gain = 
v4l2_ctrl_new_std(
0985dd306f727d Leon Luo            2017-10-05  1943             
&imx274->ctrls.handler,
0985dd306f727d Leon Luo            2017-10-05  1944             
&imx274_ctrl_ops,
0985dd306f727d Leon Luo            2017-10-05  1945             V4L2_CID_GAIN, 
IMX274_MIN_GAIN,
0985dd306f727d Leon Luo            2017-10-05  1946             
IMX274_MAX_DIGITAL_GAIN * IMX274_MAX_ANALOG_GAIN, 1,
0985dd306f727d Leon Luo            2017-10-05  1947             
IMX274_DEF_GAIN);
0985dd306f727d Leon Luo            2017-10-05  1948  
0985dd306f727d Leon Luo            2017-10-05  1949     imx274->ctrls.exposure 
= v4l2_ctrl_new_std(
0985dd306f727d Leon Luo            2017-10-05  1950             
&imx274->ctrls.handler,
0985dd306f727d Leon Luo            2017-10-05  1951             
&imx274_ctrl_ops,
0985dd306f727d Leon Luo            2017-10-05  1952             
V4L2_CID_EXPOSURE, IMX274_MIN_EXPOSURE_TIME,
0985dd306f727d Leon Luo            2017-10-05  1953             1000000 / 
IMX274_DEF_FRAME_RATE, 1,
0985dd306f727d Leon Luo            2017-10-05  1954             
IMX274_MIN_EXPOSURE_TIME);
0985dd306f727d Leon Luo            2017-10-05  1955  
0985dd306f727d Leon Luo            2017-10-05  1956     imx274->ctrls.vflip = 
v4l2_ctrl_new_std(
0985dd306f727d Leon Luo            2017-10-05  1957             
&imx274->ctrls.handler,
0985dd306f727d Leon Luo            2017-10-05  1958             
&imx274_ctrl_ops,
0985dd306f727d Leon Luo            2017-10-05  1959             V4L2_CID_VFLIP, 
0, 1, 1, 0);
0985dd306f727d Leon Luo            2017-10-05  1960  
0985dd306f727d Leon Luo            2017-10-05  1961     imx274->sd.ctrl_handler 
= &imx274->ctrls.handler;
0985dd306f727d Leon Luo            2017-10-05  1962     if 
(imx274->ctrls.handler.error) {
0985dd306f727d Leon Luo            2017-10-05  1963             ret = 
imx274->ctrls.handler.error;
0985dd306f727d Leon Luo            2017-10-05  1964             goto err_ctrls;
0985dd306f727d Leon Luo            2017-10-05  1965     }
0985dd306f727d Leon Luo            2017-10-05  1966  
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1967     /* power on the sensor 
*/
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1968     ret = 
imx274_power_on(&client->dev);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1969     if (ret < 0) {
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1970             
dev_err(&client->dev,
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1971                     "%s : 
imx274 power on failed\n", __func__);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1972             goto err_ctrls;
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1973     }
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1974  
0985dd306f727d Leon Luo            2017-10-05  1975     /* setup default 
controls */
0985dd306f727d Leon Luo            2017-10-05  1976     ret = 
v4l2_ctrl_handler_setup(&imx274->ctrls.handler);
0985dd306f727d Leon Luo            2017-10-05  1977     if (ret) {
0985dd306f727d Leon Luo            2017-10-05  1978             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1979                     "Error 
%d setup default controls\n", ret);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1980             goto 
err_power_off;
0985dd306f727d Leon Luo            2017-10-05  1981     }
0985dd306f727d Leon Luo            2017-10-05  1982  
0985dd306f727d Leon Luo            2017-10-05  1983     /* load default control 
values */
0985dd306f727d Leon Luo            2017-10-05  1984     ret = 
imx274_load_default(imx274);
0985dd306f727d Leon Luo            2017-10-05  1985     if (ret) {
0985dd306f727d Leon Luo            2017-10-05  1986             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1987                     "%s : 
imx274_load_default failed %d\n",
0985dd306f727d Leon Luo            2017-10-05  1988                     
__func__, ret);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1989             goto 
err_power_off;
0985dd306f727d Leon Luo            2017-10-05  1990     }
0985dd306f727d Leon Luo            2017-10-05  1991  
0985dd306f727d Leon Luo            2017-10-05  1992     /* register subdevice */
0985dd306f727d Leon Luo            2017-10-05  1993     ret = 
v4l2_async_register_subdev(sd);
0985dd306f727d Leon Luo            2017-10-05  1994     if (ret < 0) {
0985dd306f727d Leon Luo            2017-10-05  1995             
dev_err(&client->dev,
0985dd306f727d Leon Luo            2017-10-05  1996                     "%s : 
v4l2_async_register_subdev failed %d\n",
0985dd306f727d Leon Luo            2017-10-05  1997                     
__func__, ret);
8e6137f211b496 Sowjanya Komatineni 2020-06-03  1998             goto 
err_power_off;
0985dd306f727d Leon Luo            2017-10-05  1999     }
0985dd306f727d Leon Luo            2017-10-05  2000  
0985dd306f727d Leon Luo            2017-10-05  2001     dev_info(&client->dev, 
"imx274 : imx274 probe success !\n");
0985dd306f727d Leon Luo            2017-10-05  2002     return 0;
0985dd306f727d Leon Luo            2017-10-05  2003  
8e6137f211b496 Sowjanya Komatineni 2020-06-03  2004  err_power_off:
8e6137f211b496 Sowjanya Komatineni 2020-06-03  2005     
imx274_power_off(&client->dev);
0985dd306f727d Leon Luo            2017-10-05  2006  err_ctrls:
781b045baefdab Sakari Ailus        2017-11-01  2007     
v4l2_ctrl_handler_free(&imx274->ctrls.handler);
0985dd306f727d Leon Luo            2017-10-05  2008  err_me:
0985dd306f727d Leon Luo            2017-10-05  2009     
media_entity_cleanup(&sd->entity);
0985dd306f727d Leon Luo            2017-10-05  2010  err_regmap:
0985dd306f727d Leon Luo            2017-10-05  2011     
mutex_destroy(&imx274->lock);
0985dd306f727d Leon Luo            2017-10-05  2012     return ret;
0985dd306f727d Leon Luo            2017-10-05  2013  }
0985dd306f727d Leon Luo            2017-10-05  2014  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to