From patchwork Thu Jan 14 08:59:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 8030721 Return-Path: X-Original-To: patchwork-linux-rockchip@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9FA28BEEE5 for ; Thu, 14 Jan 2016 09:00:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C86DA20490 for ; Thu, 14 Jan 2016 09:00:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F07F720458 for ; Thu, 14 Jan 2016 09:00:21 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJdlU-00016d-PU; Thu, 14 Jan 2016 09:00:20 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aJdlS-0008Lv-3I for linux-rockchip@lists.infradead.org; Thu, 14 Jan 2016 09:00:19 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O0X00GGDQBT7410@mailout1.w1.samsung.com> for linux-rockchip@lists.infradead.org; Thu, 14 Jan 2016 08:59:53 +0000 (GMT) X-AuditID: cbfec7f4-f79026d00000418a-91-569763895c91 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 5D.60.16778.98367965; Thu, 14 Jan 2016 08:59:53 +0000 (GMT) Received: from AMDC1061.digital.local ([106.116.147.88]) by eusync2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O0X002ACQBQ1820@eusync2.samsung.com>; Thu, 14 Jan 2016 08:59:53 +0000 (GMT) From: Andrzej Hajda To: Mark Yao Subject: [PATCH] drm/rockchip/dsi: fix handling mipi_dsi_pixel_format_to_bpp result Date: Thu, 14 Jan 2016 09:59:02 +0100 Message-id: <1452761942-23864-1-git-send-email-a.hajda@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDJMWRmVeSWpSXmKPExsVy+t/xK7qdydPDDN4vU7S4te4cq8XGGetZ La58fc9m8f/Ra1aLTw/+M1usPXKX3WLHlANMDuwe97uPM3lsXlLv8XfWfhaPvi2rGD22X5vH HMAaxWWTkpqTWZZapG+XwJVx9shRpoJ2jorO86eYGhgfsXUxcnJICJhInL+8E8oWk7hwbz2Q zcUhJLCUUeLkysnsEE4Tk8TRFzOYQKrYBDQl/m6+CdYhIqAmsXPmGiaQImaBw0wSXybuB+rg 4BAWCJX4tTgfpIZFQFXi0bEprCA2r4CzxOXfO5kgtslJnDw2mXUCI/cCRoZVjKKppckFxUnp uYZ6xYm5xaV56XrJ+bmbGCFh8mUH4+JjVocYBTgYlXh4f9ydFibEmlhWXJl7iFGCg1lJhPdB wvQwId6UxMqq1KL8+KLSnNTiQ4zSHCxK4rxzd70PERJITyxJzU5NLUgtgskycXBKNTCyBZ+/ +dHq4RyPDUXFNmca/EKzuVbemPZjzZIb89avOxbNLsv/YNnj9bIsWfbxrXeEvCd/WfIqLY7r SlTJdeH42Wzfonv//9i+54zk5tMe5ptWLz/Lmbz2npxvlqPPkbVNH7Zd0cmy+LtaqqF3d4Ll pm2sX8Qnlp504t2Wua6Ttd23UPhT84IaJZbijERDLeai4kQAFGBWKA8CAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160114_010018_353864_593ECA0C X-CRM114-Status: GOOD ( 11.69 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Heiko Stuebner , "open list:ARM/Rockchip SoC support" , Bartlomiej Zolnierkiewicz , "open list:DRM DRIVERS FOR ROCKCHIP" , Andrzej Hajda , Marek Szyprowski MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Andrzej Hajda Reviewed-by: Chris Zhong --- drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index 7bfe243..f8f8f29 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) {