From: Andrzej Hajda Date: Thu, 14 Jan 2016 08:59:02 +0000 (+0100) Subject: UPSTREAM: drm/rockchip/dsi: fix handling mipi_dsi_pixel_format_to_bpp result X-Git-Tag: firefly_0821_release~3142 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b498b62d7644f0e0795c5c63ec2b6fbddbb76d14;p=firefly-linux-kernel-4.4.55.git UPSTREAM: drm/rockchip/dsi: fix handling mipi_dsi_pixel_format_to_bpp result The function can return negative value so it should be assigned to signed variable. The problem has been detected using patch scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci. Change-Id: Ide4daa64ce996d125b2f698e6f2d4899591e8065 Signed-off-by: Mark Yao Signed-off-by: Andrzej Hajda Reviewed-by: Chris Zhong (cherry picked from commit 484bb6c969523aa547d854bb57104339ee4aa800) --- diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 7bfe243c6173..f8f8f29fb7c3 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -461,10 +461,11 @@ static int dw_mipi_dsi_phy_init(struct dw_mipi_dsi *dsi) static int dw_mipi_dsi_get_lane_bps(struct dw_mipi_dsi *dsi) { - unsigned int bpp, i, pre; + unsigned int i, pre; unsigned long mpclk, pllref, tmp; unsigned int m = 1, n = 1, target_mbps = 1000; unsigned int max_mbps = dptdin_map[ARRAY_SIZE(dptdin_map) - 1].max_mbps; + int bpp; bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); if (bpp < 0) {