From patchwork Thu May 26 09:34:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 9136861 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 A91786075C for ; Thu, 26 May 2016 09:36:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 91F3320499 for ; Thu, 26 May 2016 09:36:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8662D28093; Thu, 26 May 2016 09:36:53 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2904F20499 for ; Thu, 26 May 2016 09:36:53 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5rhM-0002sp-Cx; Thu, 26 May 2016 09:35:24 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b5rhJ-0001fG-0N for linux-arm-kernel@lists.infradead.org; Thu, 26 May 2016 09:35:21 +0000 Received: by mail-wm0-x242.google.com with SMTP id a136so3508176wme.0 for ; Thu, 26 May 2016 02:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=+NYPkMGddDMeLOp47L8u+04jQT2FsTe7xKutYU+4GwQ=; b=F6PEq+1dIX5jrQswQ+aSgII4YvtofExRaOI4qvANUG8EYKP+coFMFjNVLD6aLEpvCJ YkEnj3k4x3JcoSdkE67c9SCbYdu91Cdy2X1eijJRjwsOEmH+1X4iu1QKLojdmaqt0RpM FUkIu+BH9Km4ORdrVVo+GlNb27Ogac3/GQcOCZQMSU5ikoOpSK03AQcGxJ5lDmNAPVa7 k1x+zyGthE8wTuYQfqdPzWlGmPku4W9GsrO4L4eP00wWW0AohwJQfKGn/L1TUg/kIhO1 9QD+Af9HzNp7ouGGWsrXfAGCzSilx0QVhoOZtg9MxshnDdL0I7mIiqwyj9uJy+ASxEX2 CBww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+NYPkMGddDMeLOp47L8u+04jQT2FsTe7xKutYU+4GwQ=; b=a+61doapIcc4YGUZaPUuxVayjmRcWHiPk4TDfWcG0htqxxQw3cA6XJMDJhj78aLbJC IjERIMolFTLQlp7z3PRxw4fMrninuzqfiaWL2J9SWNwhwRnmq+IeDRpGs2mLwz43Ke5A xsSCKcEVDWWsE/5LBkjq+CBzlVeKSatq2yfGyNTyMVd5XaaV/I2qrHEJ8tYMLijc2yKP 5n8GTi2vecAkYoQm2RpR0+eoz4pUI5HaWxd233UrDmWNYhzc29TaeQs7oLl512k/gQJs WkL1JibNnKJSGOAm0J780zDDJbbPluaU9+A1WgmVquMMsmBrvUPSI8LxsuI3h40dBgXx q+1w== X-Gm-Message-State: ALyK8tKSQpvESaXse4bGT0Fa5XwRmQ+QnSTdapB564YdZMgitUiURI4qZ4K7zolMHsmDjA== X-Received: by 10.194.123.9 with SMTP id lw9mr9658424wjb.53.1464255299115; Thu, 26 May 2016 02:34:59 -0700 (PDT) Received: from lmecul0520.st.com. (242.202.154.77.rev.sfr.net. [77.154.202.242]) by smtp.gmail.com with ESMTPSA id ju3sm13386390wjb.11.2016.05.26.02.34.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 May 2016 02:34:58 -0700 (PDT) From: Maxime Coquelin To: Matt Mackall , Herbert Xu , Maxime Coquelin , Sudip Mukherjee , Arnd Bergmann , Daniel Thompson Subject: [PATCH] hwrng: stm32: fix maybe uninitialized variable warning Date: Thu, 26 May 2016 11:34:57 +0200 Message-Id: <1464255297-21090-1-git-send-email-mcoquelin.stm32@gmail.com> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160526_023521_196408_B78D3BAB X-CRM114-Status: GOOD ( 13.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org 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 This patch fixes the following warning: drivers/char/hw_random/stm32-rng.c: In function 'stm32_rng_read': drivers/char/hw_random/stm32-rng.c:82:19: warning: 'sr' may be used uninitialized in this function Reported-by: Sudip Mukherjee Suggested-by: Arnd Bergmann Cc: Daniel Thompson Signed-off-by: Maxime Coquelin Reviewed-by: Daniel Thompson --- drivers/char/hw_random/stm32-rng.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index 92a810648bd0..63d84e6f1891 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -69,8 +69,12 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) } /* If error detected or data not ready... */ - if (sr != RNG_SR_DRDY) + if (sr != RNG_SR_DRDY) { + if (WARN_ONCE(sr & (RNG_SR_SEIS | RNG_SR_CEIS), + "bad RNG status - %x\n", sr)) + writel_relaxed(0, priv->base + RNG_SR); break; + } *(u32 *)data = readl_relaxed(priv->base + RNG_DR); @@ -79,10 +83,6 @@ static int stm32_rng_read(struct hwrng *rng, void *data, size_t max, bool wait) max -= sizeof(u32); } - if (WARN_ONCE(sr & (RNG_SR_SEIS | RNG_SR_CEIS), - "bad RNG status - %x\n", sr)) - writel_relaxed(0, priv->base + RNG_SR); - pm_runtime_mark_last_busy((struct device *) priv->rng.priv); pm_runtime_put_sync_autosuspend((struct device *) priv->rng.priv);