[bug-report] Smatch warns unsigned comparison with zero in dw_mipi_dsi_rockchip_set_lcdsel()

Harshit Mogalapalli harshit.m.mogalapalli at oracle.com
Mon Oct 17 15:03:28 UTC 2022


Hi,


Smatch warns:
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c:755 
dw_mipi_dsi_rockchip_set_lcdsel() warn: unsigned 
'dsi->cdata->lcdsel_grf_reg'
is never less than zero.

static void dw_mipi_dsi_rockchip_set_lcdsel(struct dw_mipi_dsi_rockchip 
*dsi,
                                             int mux)
{
         if (dsi->cdata->lcdsel_grf_reg < 0)
                 regmap_write(dsi->grf_regmap, dsi->cdata->lcdsel_grf_reg,
                         mux ? dsi->cdata->lcdsel_lit : 
dsi->cdata->lcdsel_big);
}

'dsi->cdata->lcdsel_grf_reg' is of u32 type, it can never be less than zero.
So the above if condition is an impossible one.

Note: 'lcdsel_grf_reg' is set to -1 at other places.


Thanks,
Harshit


More information about the dri-devel mailing list