Skip to contentSkip to conversation

thermal: tegra: add hw-throttle function

bug report Dan Carpenter 1 participant 1 message Oct 13, 2016 Tegra architecture support

lore
Share & tools
lore
#0 lore raw

Hello Wei Ni,

This is a semi-automatic email about new static checker warnings.

The patch ce0dbf04f685: "thermal: tegra: add hw-throttle function" from May 11, 2016, leads to the following Smatch complaint:

drivers/thermal/tegra/soctherm.c:486 throttrip_program()
warn: variable dereferenced before check 'dev' (see line 481)

drivers/thermal/tegra/soctherm.c
480 {

   481		struct tegra_soctherm *ts = dev_get_drvdata(dev);
                                                            ^^^

Dereference inside function.

482 int temp, cpu_throt, gpu_throt;
483 unsigned int throt;
484 u32 r, reg_off;
485
486 if (!dev || !sg || !stc || !stc->init)

                     ^^^

Check is too late.

487 return -EINVAL;
488

regards,
dan carpenter