[bug report] PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver

Dan Carpenter dan.carpenter at oracle.com
Mon Jun 13 04:13:28 PDT 2022


Hello Johnson Wang,

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

The patch 9f3ec0f65421: "PM / devfreq: mediatek: Introduce MediaTek 
CCI devfreq driver" from Jun 7, 2022, leads to the following Smatch 
complaint:

    drivers/devfreq/mtk-cci-devfreq.c:135 mtk_ccifreq_target()
    warn: variable dereferenced before check 'drv' (see line 130)

drivers/devfreq/mtk-cci-devfreq.c
   129		struct mtk_ccifreq_drv *drv = dev_get_drvdata(dev);
   130		struct clk *cci_pll = clk_get_parent(drv->cci_clk);
                                                     ^^^^^^^^^^^^
Dereference

   131		struct dev_pm_opp *opp;
   132		unsigned long opp_rate;
   133		int voltage, pre_voltage, inter_voltage, target_voltage, ret;
   134	
   135		if (!drv)
                    ^^^^
Checked too late.

   136			return -EINVAL;
   137	

regards,
dan carpenter



More information about the Linux-mediatek mailing list