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: 132521 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp494038ljb; Wed, 28 Mar 2018 06:45:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx49pouFsHPJtRvDEX0fX6qdZgI+HMtPNQvu11YYWCiQEWEjbWiqo5GjKyDYdpB03AXJO2kdh X-Received: by 2002:a17:902:a9c4:: with SMTP id b4-v6mr3961908plr.333.1522244759797; Wed, 28 Mar 2018 06:45:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522244759; cv=none; d=google.com; s=arc-20160816; b=XBiKp8/nH6ZSfpZKJ72p+IJasxOJViRSjh4nrvcVLC64Y6E8xbqHKurAK0zjMIVdRs HT49FD+aB/EnQ73gjMCAE3wh+WBkIuDp78/WpyDnoQQtoi/p7RtBwePVR940uUhUCMH8 5IzE4yWDgzd67zZbPd6VDM5KM5p9jut5bYkK9vvdpr8tTXoYB1Sh/t8GGQCCt/2D5ReR ONFH/kCHejzb/+BfoKztqe2YJG7Zn8rvTx73uLmA+CCbbTEU/a+VsPsdYu4xHn4AISR/ 94TLtxIxOcveJ1QOTL3e40pa208/kk3Cp+IFrz4iuUvo/jbv1ei01DeQBWTcTVxzrQPg qMKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=h6dZB9riyM7NRIM9dhlMzMv31DE7MsjOQ68DRGKtWU0=; b=NcX1nbHVsTotDTBVXIOofQUCLqk09JLr5cYnQcjiCjp+aRWLq2TBshQdVyayGLqTSx 5+ZycoWkkQhSEADUaqIsRBlsewbQKDXUN2jUDQ/pTJAs/Qb4ElDsFpGktJPAh0SUNeu/ w6DGVy+ebF4uJKFVwVQre60X4GfMmjjbViEs85fqJwtCeYAzL/I8zGaByxkXpyMaN72g QPd98j0iTJ50crZlhbBNnhdZPxLK8Xgp3duNWQbc1sJlEbWHT3rTvi3K404zJBbrg/y4 Fhyibdw6iVjXE9cvy/Qlhd53lZFcRwXmpVjzzf3Sk/WQaIAMoiG4YfPHqoelryW/0a8W ad3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t13si2532173pgs.430.2018.03.28.06.45.59; Wed, 28 Mar 2018 06:45:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072AbeC1Np6 (ORCPT + 3 others); Wed, 28 Mar 2018 09:45:58 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:37335 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750820AbeC1Np5 (ORCPT ); Wed, 28 Mar 2018 09:45:57 -0400 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 Cc: Arnd Bergmann , Marek Szyprowski , Maciej Purski , linux-pm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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 --- drivers/thermal/samsung/exynos_tmu.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.9.0 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Bartlomiej Zolnierkiewicz 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; }