On 03/09/16 15:52, kbuild test robot wrote:
> Hi Jyri,
>
> [auto build test WARNING on drm/drm-next]
> [also build test WARNING on v4.5-rc7 next-20160309]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improving the system]
>
> url:    
> https://github.com/0day-ci/linux/commits/Jyri-Sarha/Implement-generic-ASoC-HDMI-codec-and-use-it-in-tda998x/20160309-041821
> base:   git://people.freedesktop.org/~airlied/linux.git drm-next
> config: x86_64-rhel (attached as .config)
> reproduce:
>          # save the attached .config to linux build tree
>          make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>     drivers/gpu/drm/i2c/tda998x_drv.c: In function 'tda998x_get_audio_ports':
>>> drivers/gpu/drm/i2c/tda998x_drv.c:1345:7: warning: 'size' is used 
>>> uninitialized in this function [-Wuninitialized]
>       size /= sizeof(u32);
>            ^
>
> vim +/size +1345 drivers/gpu/drm/i2c/tda998x_drv.c
>
>    1329               if (IS_ERR(priv->audio_pdev))
>    1330                       return PTR_ERR(priv->audio_pdev);
>    1331       
>    1332               return 0;
>    1333       }
>    1334       
>    1335       /* I2C driver functions */
>    1336       
>    1337       static int tda998x_get_audio_ports(struct tda998x_priv *priv,
>    1338                                          struct device_node *np)
>    1339       {
>    1340               const u32 *port_data;
>    1341               u32 size;
>    1342               int i;
>    1343       
>    1344               port_data = of_get_property(np, "audio-ports", &size);
 >> 1345                size /= sizeof(u32);

Oops, that is a real bug. I should test if port_data is not null before 
assuming that the size has been set (/me thinks that he had that line 
there at some point but then it vanished). Actually initializing size to 
0 would be enough, but I think I'll do the both just to be more explicit.

And I'll start using PTR_ERR_OR_ZERO() while I am at it.

>    1346       
>    1347               if (size > 2 * ARRAY_SIZE(priv->audio_port) || size % 2 
> != 0) {
>    1348                       dev_err(&priv->hdmi->dev,
>    1349                               "Bad number of elements in audio-ports 
> dt-property\n");
>    1350                       return -EINVAL;
>    1351               }
>    1352       
>    1353               size /= 2;
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>

Reply via email to