From patchwork Wed May 11 12:49:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102364 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp206813qge; Wed, 11 May 2016 05:50:59 -0700 (PDT) X-Received: by 10.66.65.235 with SMTP id a11mr4589198pat.155.1462971059056; Wed, 11 May 2016 05:50:59 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id uy10si9682849pac.210.2016.05.11.05.50.58; Wed, 11 May 2016 05:50: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 S1751836AbcEKMu5 (ORCPT + 4 others); Wed, 11 May 2016 08:50:57 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55471 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbcEKMu5 (ORCPT ); Wed, 11 May 2016 08:50:57 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0Lno43-1bXtjk3EQp-00hs9k; Wed, 11 May 2016 14:50:15 +0200 From: Arnd Bergmann To: Kishon Vijay Abraham I Cc: Arnd Bergmann , Kukjin Kim , Krzysztof Kozlowski , Sylwester Nawrocki , Marek Szyprowski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use Date: Wed, 11 May 2016 14:49:53 +0200 Message-Id: <1462971012-562097-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:cX9b5cLBD0sFJFaAaz7cmgoUDAA99K6cBQwtExGwpxiWkglcRxN FZDsSOqc3Bsl1V2w3xo00QXADVhtVPi/oj28LE4wB2pBJ2rYpZiJq8vRGyati8fMRha7Tlr yI4UsEjp0vVcWw5X1ped7lvKMti5eHR8j3WyWb/Nlq0ShSLjnkyLDtWavTdN3TnzxYROoPV jrflTY7iuxGitWVGArDvA== X-UI-Out-Filterresults: notjunk:1; V01:K0:iyBE0SwheI4=:PvrqXwTYLzQQbQkOe2cAyH oEdhRTDI173xjTVnRSIrp/cczHiheRi7a3kRe88/3dlkVSoEeyD/tN1rPGZZf2PpxYG/f5wzU smNiejnb2SSRhyXd8Z/Ih3aFFrjqyyzJ2fM4LBEZm2quanMHWmjHZnMDen831Qgth8TF+Y8yv IihAex7qkXyO7NlsLJGfq3cX9Kc/ptRw74mCMku6XXVpbuVHb5e9y4gKoD8rvDypIt1jbDexZ Z8jz9Ljkb3QWo1+TRxXAHNZKBS2d6CqyHK7Tc3Fm2RKocoKvpkduNRhgR50qZhs4NxO3AIMO5 2+dReTDysp2QUyqflL2/rmPelNh/j/lp/6FgxJIlJQtvMoK3e7VA7kIiMqrLjc1f49vB3450h 7V3W1tK87ecdWv7186c/ovTOr7Y/mKWMKgyy2hnf3lvsgktkfvMzcxNTGa9rKjgiuUZVE5Bgj ifDgdB0chB4vhUUH97WZ4U/r5lFjZv/R2+DUmyYYtmpxu4og2tyveb1/936aDFHvzViPeqrFg bZkf/imd3uz6T1mHw52Yg8WE8+Pc5Hh+tzJh1fMll6PDLhXOTCWd66WbAx0lY0/CXo48FPTUP AG8EmVT3phFiGWRLF1PBIqltWrAwgI+Bd8rYW/qzdvm+IpxNwITrNBdVcWhC6RfByIsw2EUqW qJcBw2dvmeu1MFxuACSLRvBcrHIkXQ+xJXsj+SvA2PuNgCLEG1BKGV7h3Hgf1mutRO2k= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org A rework of the exynos-mipi-video driver caused a warning about the new __set_phy_state function potentially accessing a variable before its initialization: drivers/phy/phy-exynos-mipi-video.c: In function '__set_phy_state': drivers/phy/phy-exynos-mipi-video.c:238:13: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized] return val & data->resetn_val; ~~~~^~~~~~~~~~~~~~~~~~ drivers/phy/phy-exynos-mipi-video.c:235:6: note: 'val' was declared here u32 val; The failure scenario here is the offset passed into a the stub regmap_read() function that does not modify its output, however regmap_read() can also fail for other reasons, so adding error handling (in this case, returning zero from is_running) seems the best solution. Note that this warning showed up with the ARM s5pv210_defconfig, indicating that we most likely want to either enable CONFIG_REGMAP in that defconfig as well, or disable the phy-exynos-mipi-video driver. Signed-off-by: Arnd Bergmann Fixes: 97a3042f7616 ("phy: exynos-mipi-video: Rewrite handling of phy registers") --- drivers/phy/phy-exynos-mipi-video.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.7.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 diff --git a/drivers/phy/phy-exynos-mipi-video.c b/drivers/phy/phy-exynos-mipi-video.c index cc093ebfda94..8b851f718123 100644 --- a/drivers/phy/phy-exynos-mipi-video.c +++ b/drivers/phy/phy-exynos-mipi-video.c @@ -233,8 +233,12 @@ static inline int __is_running(const struct exynos_mipi_phy_desc *data, struct exynos_mipi_video_phy *state) { u32 val; + int ret; + + ret = regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); + if (ret) + return 0; - regmap_read(state->regmaps[data->resetn_map], data->resetn_reg, &val); return val & data->resetn_val; }