From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751721AbcEYSze (ORCPT ); Wed, 25 May 2016 14:55:34 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:61490 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbcEYSzc (ORCPT ); Wed, 25 May 2016 14:55:32 -0400 From: Arnd Bergmann To: Krzysztof Kozlowski Cc: Kishon Vijay Abraham I , 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: Re: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use Date: Wed, 25 May 2016 20:54:59 +0200 Message-ID: <14219690.YQPrXjp7cP@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-22-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20160511185155.GB8265@kozik-lap> References: <1462971012-562097-1-git-send-email-arnd@arndb.de> <20160511185155.GB8265@kozik-lap> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:CjX2LYMgIwTSOJR/pQgNge2uXXcGfS7gex1bZeYHWR6zwGaN3lV 1mrLa30PNT69wDaUynWB71tX09ddMNmMeIVRy3E/jxtgnfpKyr+ENnoylTaWREx5KREd6Vj +j1jJhR/V9MgCMhOud4pxpKeSbavzbcfDq1yx7eaOctwmZ2+tMF+INrrbyYKN3DlVWyiwGM +qmuh0QNalnLMuyUn9pMg== X-UI-Out-Filterresults: notjunk:1;V01:K0:a5+hbhfJhdw=:8aJHeHF8DFDyYNrd0pCWTT HRwj0ah4o/817dc6XQrCa9EiLD1rz+3QQZl1kqu3sVGfPGsbUAXar4s0CPuCDynEJPUwUXyVQ OYhiYNrm7NJbA2Fu62T9Sg9fgFH0OljMVNdEwPT3EB94XD/ZUn8JEbzQPY8I7VEcjUt1SluIv u8zaXZkrKsptwCT60I6lc4tSksVG9N23pusuwCc4QPXYZhTCxJQfRyU5N5lcVVJsGT1Q4sKuB HysfWhPPukkrVSj/JP9y3F3Rsb9zPEVChj6l6qXqgATaYPSKRcevIS04HJ3stgvHuiTIyQ1a7 /LNJrd4RqS7D3yaR66myi4GYblvaE9ZeBbcGxd5hZNlS/Ps3b5/hnjmMUiiNW3sSpkD8/rWOC 16UGBgIeC/R24ihR5TfQE8gvCZXpoOlKHNzp6DAcuQ/e7pr/JIVppN0flXPFAMKBvLJLlI0dB EmuLYu3X1JQQvTbC9UDOudsGI+EfpLLua0qJsLl3+muWzmErG3+ZmoY9qJ98ej4sRLW7/krAr kupgVBrqbtYP14yYSNdotd0d0iOOI2bLDjMClsjgjmxBqscIDnPpyi6WAlsxr+GYLsk72xrod N4we/zaItaE81eiRm2u/MQUCdXwIifqLO1drnnFpQ1ug/XsQ5q6nHcRVrong9NhObpatdAbOk NnI7db/5ReORgVtYk2IcXAOyzTkdiHfJGmvPbYpzIEv6nAlUSMO4ENkgE3FznOc0wrhZRMRbU 3HRaLFI/9cz4+W/hQt5np1bASSpYpaSOge/8dA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote: > On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote: > > 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(-) > > > > 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; > > Other way would be to initialize val=0 since there is no real error code > returned. Anyway: > > Reviewed-by: Krzysztof Kozlowski This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2? Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Wed, 25 May 2016 20:54:59 +0200 Subject: [PATCH] phy: exynos-mipi-video: avoid uninitialized variable use In-Reply-To: <20160511185155.GB8265@kozik-lap> References: <1462971012-562097-1-git-send-email-arnd@arndb.de> <20160511185155.GB8265@kozik-lap> Message-ID: <14219690.YQPrXjp7cP@wuerfel> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wednesday, May 11, 2016 8:51:55 PM CEST Krzysztof Kozlowski wrote: > On Wed, May 11, 2016 at 02:49:53PM +0200, Arnd Bergmann wrote: > > 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(-) > > > > 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; > > Other way would be to initialize val=0 since there is no real error code > returned. Anyway: > > Reviewed-by: Krzysztof Kozlowski This hasn't made it into linux-next yet, any chance we'll see it in -rc1 or -rc2? Arnd