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: 8030711 Return-Path: X-Original-To: patchwork-dri-devel@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 A01C1BEEE5 for ; Thu, 14 Jan 2016 09:00:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB1B420497 for ; Thu, 14 Jan 2016 09:00:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id CAB8520490 for ; Thu, 14 Jan 2016 08:59:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5C75F6E470; Thu, 14 Jan 2016 00:59:58 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CD2A6E470 for ; Thu, 14 Jan 2016 00:59:57 -0800 (PST) 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 dri-devel@lists.freedesktop.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= Cc: "open list:ARM/Rockchip SoC support" , Bartlomiej Zolnierkiewicz , "open list:DRM DRIVERS FOR ROCKCHIP" , Andrzej Hajda , Marek Szyprowski X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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) {