From patchwork Fri May 22 11:06:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 6463641 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D0500C0020 for ; Fri, 22 May 2015 11:07:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D66E2045B for ; Fri, 22 May 2015 11:07:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0216D20458 for ; Fri, 22 May 2015 11:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752617AbbEVLH2 (ORCPT ); Fri, 22 May 2015 07:07:28 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:50312 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755852AbbEVLH1 (ORCPT ); Fri, 22 May 2015 07:07:27 -0400 Received: from wuerfel.localnet ([149.172.15.242]) by mrelayeu.kundenserver.de (mreue004) with ESMTPSA (Nemesis) id 0Lv6ko-1ZLqPM19W6-010NsT; Fri, 22 May 2015 13:06:38 +0200 From: Arnd Bergmann To: Felipe Balbi Cc: Nobuhiro Iwamatsu , Simon Horman , Magnus Damm , linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] usb: renesas_usbhs: avoid uninitialized variable use Date: Fri, 22 May 2015 13:06:35 +0200 Message-ID: <16028110.26u0uMKA2O@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) MIME-Version: 1.0 X-Provags-ID: V03:K0:SOa0Oz4k73oC1NSexILNzTn0+e41P/rryEUW+ty1zzQ13Dtzfyn OIxI6ZO4Z9jcdDGmSkf9RNNI6KvP+rDbqQn6bIdvjBnlpBNxFTUreBm28yA6ofi6WS38YHI kdV6izSi8mIC263LAfdk93lFD+ofQRmwMcACTCYW3Bgjx65/HyVE3fM/chYGzRG4EggluVg 9C2UPpOpWU8LVCsIzVlnA== X-UI-Out-Filterresults: notjunk:1; Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP After the renesas_usbhs driver is enabled in ARM multi_v7_defconfig, we now get a new warning: renesas_usbhs/mod.c: In function 'usbhs_interrupt': renesas_usbhs/mod.c:246:7: warning: 'intenb1' may be used uninitialized in this function [-Wmaybe-uninitialized] gcc correctly points to a problem here, for the case that the device is in host mode, we use the intenb1 variable without having assigned it first. The state->intsts1 has a similar problem, but gcc cannot know that. This avoids the problem by initializing both sides of the comparison to zero when we don't read them from the respective registers. Signed-off-by: Arnd Bergmann Fixes: 88a25e02f3 ("usb: renesas_usbhs: Add access control for INTSTS1 and INTENB1 register") Acked-by: Yoshihiro Shimoda Reviewed-by: Simon Horman --- To unsubscribe from this list: send the line "unsubscribe linux-sh" 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/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index e5ce6e6d4f51..d4be5d594896 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c @@ -223,6 +223,8 @@ static int usbhs_status_get_each_irq(struct usbhs_priv *priv, if (usbhs_mod_is_host(priv)) { state->intsts1 = usbhs_read(priv, INTSTS1); intenb1 = usbhs_read(priv, INTENB1); + } else { + state->intsts1 = intenb1 = 0; } /* mask */