From patchwork Sun Oct 21 16:34:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10654199 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EEA0913BF for ; Wed, 24 Oct 2018 07:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6EF82A658 for ; Wed, 24 Oct 2018 07:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA3292A66E; Wed, 24 Oct 2018 07:20:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 70F642A658 for ; Wed, 24 Oct 2018 07:20:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Jfxu7zm0lQqFxdwJs1Aml4Pu6RxtJ5OTl5i1YbYg+YE=; b=LVuohqTYyUjbyH 9CxLjgZvgeUT9GtUj9qlF/OjB12cSy0Ct/icTAoLNH7sQoCDPwQfklm5hILMwvGWKQnKrm9jD+0Oh T9OMqEj8yK10mwG6TXPTLXkjg50aAiaPIOW2BIE5O3GqwN6lz7E7QTL1UGSFUd0FETO46zcLnlGiL jihsWq25X5NlLfdepdxPF43d/wSypWMdr875GGmkXgcMKfkY8OMIVigWD18V2h2Z7RqbAZwy1IAcc VkapnUmraE+c18WrVic4SBpmJ/g7Es9ZXW2djaVFSNgOoq7HafL/Q0KbLYR9dBuvJxULZljLcRngu OMbEjS9jOmf7alWBMkpw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDSz-0002vq-6z; Wed, 24 Oct 2018 07:20:33 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDSS-0001Rx-LR for linux-arm-kernel@lists.infradead.org; Wed, 24 Oct 2018 07:20:09 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 9C48F208B0; Wed, 24 Oct 2018 09:19:47 +0200 (CEST) Received: from localhost (unknown [2.223.63.88]) by mail.bootlin.com (Postfix) with ESMTPSA id 62B1420794; Wed, 24 Oct 2018 09:19:47 +0200 (CEST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard Subject: [PATCH 1/2] drm/sun4i: hdmi: Fix unitialized variable Date: Sun, 21 Oct 2018 18:34:45 +0200 Message-Id: <20181021163446.29135-1-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181024_002000_913796_A963DBA3 X-CRM114-Status: GOOD ( 13.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The is_double variable is used to store, and possibly returning to the calling function, whether it needs to double the rate of the parent clock or not. In the case where it does, the variable is affected, but in the case where it doesn't we return some uninitialized value. Fix this. Reported-by: Dan Carpenter Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c index 3ecffa52c814..cd2348554bac 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c @@ -35,7 +35,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, { unsigned long best_rate = 0; u8 best_m = 0, m; - bool is_double; + bool is_double = false; for (m = div_offset ?: 1; m < (16 + div_offset); m++) { u8 d; From patchwork Sun Oct 21 16:34:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10654205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6BE7613A4 for ; Wed, 24 Oct 2018 07:21:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56B242A658 for ; Wed, 24 Oct 2018 07:21:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B44D2A66E; Wed, 24 Oct 2018 07:21:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4C2B22A662 for ; Wed, 24 Oct 2018 07:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c86hQkXJuySh3s1OpRIBl2VCIQ42wmPsT+shrfeOyQA=; b=Apr1kwLgwq7KA6 8sslfYh1rLSXcuYUjbpUkiYYTyzOcJG+iFNyuvbritox15djqjKkmH6TIS4BbjxOL8mE0dl1fIM7Q YsNFTHVaPqbAyeab+bk3rfWXh6cNqZnebVtQM8Rwdqx9rf0/CEq9TxwTk/QhFHfRb5GMqy7YgKR5x R5mCjnryF8nYjJePGSHXEyk+dEEex4bfPPtVSFzF9QXFATClufJqEGeCDcqiGBQuQTzftnI8RRr6i E3unaxJFT677namMxDCy73XrpiOxAu6tQME/aSpZTWFoYu0mP5aUK9uRdy8Vlc5pWVN8PC2LMVLOi 8nX/29ugdRx9C1DTozzA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDTa-0003D6-CH; Wed, 24 Oct 2018 07:21:10 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gFDSS-0001Rq-PP for linux-arm-kernel@lists.infradead.org; Wed, 24 Oct 2018 07:20:13 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id 11AAE208A4; Wed, 24 Oct 2018 09:19:47 +0200 (CEST) Received: from localhost (unknown [2.223.63.88]) by mail.bootlin.com (Postfix) with ESMTPSA id CC32720794; Wed, 24 Oct 2018 09:19:46 +0200 (CEST) From: Maxime Ripard To: Chen-Yu Tsai , Maxime Ripard Subject: [PATCH 2/2] drm/sun4i: hdmi: Fix double flag assignation Date: Sun, 21 Oct 2018 18:34:46 +0200 Message-Id: <20181021163446.29135-2-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181021163446.29135-1-maxime.ripard@bootlin.com> References: <20181021163446.29135-1-maxime.ripard@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181024_002000_985681_C91E7044 X-CRM114-Status: GOOD ( 13.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The is_double flag is a boolean currently assigned to the value of the d variable, that is either 1 or 2. It means that this is_double variable is always set to true, even though the initial intent was to have it set to true when d is 2. Fix this. Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") Reported-by: Dan Carpenter Signed-off-by: Maxime Ripard Reviewed-by: Giulio Benetti --- drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c index cd2348554bac..fb985ba1a176 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_tmds_clk.c @@ -52,7 +52,7 @@ static unsigned long sun4i_tmds_calc_divider(unsigned long rate, (rate - tmp_rate) < (rate - best_rate)) { best_rate = tmp_rate; best_m = m; - is_double = d; + is_double = (d == 2) ? true : false; } } }