From patchwork Wed Mar 28 13:44:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10313315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8A06160383 for ; Wed, 28 Mar 2018 13:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78F3F29F63 for ; Wed, 28 Mar 2018 13:46:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D23229F9A; Wed, 28 Mar 2018 13:46:02 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 E2C8129F74 for ; Wed, 28 Mar 2018 13:46:01 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: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=hwYEFEnHnZSgaWkJeKMST43FCuIjsb6IAIUKz/HsZfY=; b=nN3 HkTyDIZ2I19GantCUtKIsWk94ha7iO3bI3XigdefoaDLi5orbZjcK0IsbczK7IbEZBq818y9rBMdZ Qfunog7wmNbiOLwU2716GWavln6xVlDegs0e4Gx5yLvPGheIpMNtftHBdAGQnExTDaASl4xCkk1vg q5pQq5zN5iDBk+U/wXROxlqL6Ey2nDLcVmBMy9gWxYVEy/E8f3F4Ji8ve7fgCvG2JZq4SUmsiUTOI ZVYAv9UGJCCp1HwP4S23mwpIWHEuw+Fbfrda4tYm6oTAvhr8Rx6ccoSDEtkPloFEYl0lBDkngJdYZ xot7EUvCVoGQaGAlUevLBLh7cRM3iRQ==; 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 1f1BOk-0005nd-PD; Wed, 28 Mar 2018 13:45:54 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f1BOh-0005mh-Pb for linux-arm-kernel@lists.infradead.org; Wed, 28 Mar 2018 13:45:53 +0000 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue104 [212.227.15.145]) with ESMTPA (Nemesis) id 0LrsTu-1eZ5cD1yX8-013h6M; Wed, 28 Mar 2018 15:45:23 +0200 From: Arnd Bergmann To: Bartlomiej Zolnierkiewicz , Zhang Rui , Eduardo Valentin , Kukjin Kim , Krzysztof Kozlowski Subject: [PATCH] thermal: exynos_tmu: avoid uninitialized variables Date: Wed, 28 Mar 2018 15:44:44 +0200 Message-Id: <20180328134520.1970967-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:tnqi/xk05bSjeWxw7K4Em0TJIso4HcTnOmlTAhaP89T3TMI/zoK f/dlI81QADNtu6QhaymoFFuf+k+taO6Da/31Mb09FnW27I+y4XrqeR7ceX/qEXJiC2lOQPl sy47TF14pI8nzwC3wszZtRDi+wVf6Dzcnqw2+MLTnQl6kFB46jizPzdZb2lg9cMJGOseEaG AkteiTl+1Ra3E0J9PBRjg== X-UI-Out-Filterresults: notjunk:1; V01:K0:Ly3cRcJtkr4=:UHgcC0Yu2sSyqQFH5Rkl3G vvCTpSQBe1Ixbg2XX59ADkHvew5udTh3a2PTyyRmJPQy1/YnHSQLrMBOW0cHGFc5JwjzKBqWS YTqX2asumWWSiBUbswHLNodU67WtIkl8rajVqc0vjLN+TvfS2/GOBbYrhkAeb+upjRiG0ba8o U9HkDYcXLY7x+9tcsVGrKI2lA72NajPVjKMrfFz8JCI7DB1+yH33NSxXiCBiIN+xjhuxa9tD/ iS10i6PzeGQahgh+w4A64hGOZuHKODGQNf8su1ogk8EXyvU3qCr7yfxl4GYSqHwYTyXWZo4Do F6vLCGCG8Yz8m+ol8ikH/Ep/ncUpDeCygQsdzL9KIr9rwNqNZtC72LqUhGXVKwVt7gPARh3rN WfWrMPld44wzUR29Mli1VfJmTKNaS9dsvJHPlvpRQgX1HRjdeh3hdrpYSM8CIMMATMJVemJ8g wj7P08r25yosZn3JgU7CPU/EbbGg5h6tbCnmE8dIClPHf+XI3cv0tp/korOnQRiSLjcS+jMeD 8h1swkTyUcxA/twSpqppL6bWDDarrD/8eFi6D5D4tmH+IaXypRVWUyq0Sh1z4+c4RYUxbewND 3OuLJrboWPDK3aBA5F0V5Ou1hYlU6D+KkLLTz72qDY+ujUES9+bkldgspuc2aq7kr5N3zjsei hd6frsCeVgwTBEbPZZ77Q7n8nr3qcry+knYmQQwlmYbFIEwWBexjVIZAU9JBsJaF9lws83x2r rHSB9wkafLX0rIrocsATXB+zruPEWo6L6i7xYQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180328_064552_136353_6C4C30B5 X-CRM114-Status: GOOD ( 10.93 ) 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-samsung-soc@vger.kernel.org, Arnd Bergmann , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Maciej Purski , linux-arm-kernel@lists.infradead.org, Marek Szyprowski MIME-Version: 1.0 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 Removing the initialization in the error case introduced a compile-time warning: drivers/thermal/samsung/exynos_tmu.c: In function 'temp_to_code': drivers/thermal/samsung/exynos_tmu.c:304:9: error: 'temp_code' may be used uninitialized in this function [-Werror=maybe-uninitialized] return temp_code; ^~~~~~~~~ drivers/thermal/samsung/exynos_tmu.c: In function 'exynos_get_temp': drivers/thermal/samsung/exynos_tmu.c:931:37: error: 'temp' may be used uninitialized in this function [-Werror=maybe-uninitialized] *temp = code_to_temp(data, value) * MCELSIUS; Let's assume the runtime warning is sufficient, and make it return a well-defined number instead of unintialized data. Fixes: 480b5bfc16e1 ("thermal: exynos: remove parsing of samsung, tmu_default_temp_offset property") Signed-off-by: Arnd Bergmann Acked-by: Bartlomiej Zolnierkiewicz --- drivers/thermal/samsung/exynos_tmu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 2ec854851da1..7e351fffdaee 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -298,6 +298,7 @@ static int temp_to_code(struct exynos_tmu_data *data, u8 temp) break; default: WARN_ON(1); + temp_code = 0; break; } @@ -324,6 +325,7 @@ static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) break; default: WARN_ON(1); + temp = 0; break; }