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: 9136853 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 E7CAE6075C for ; Thu, 26 May 2016 09:35:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D775F20499 for ; Thu, 26 May 2016 09:35:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6500281D4; Thu, 26 May 2016 09:35:06 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0237B20499 for ; Thu, 26 May 2016 09:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752521AbcEZJfC (ORCPT ); Thu, 26 May 2016 05:35:02 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:36351 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbcEZJfA (ORCPT ); Thu, 26 May 2016 05:35:00 -0400 Received: by mail-wm0-f66.google.com with SMTP id q62so3502403wmg.3; 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=MQazM4CU8CdpzzPOVMR1tbe9ZybLCBj5fFYl77fgWjKDebsWwExZ/ocDbj/PVj73VI efIKhBHIFt6AimSnYvSSX+7n0nWqN+j7kaukVqWuKQkxstY9lGeBUQmoV0C0SzfaSwUC /jxMwOW5QwBfpfsSC17cpc4nIOSDhM6DKFLxkTH7hXaFXvJ3NissYnw5i7zSWa4S4erN ksQopdCdBShwGsFAz1TaKHlXjos+3CqCBoZXllYEf0s37GpghV35MjNQtqx5tntdF84f keosDZqOO9nGdu/VLJzy6r2+TGZtJl/7zyIydeh1S2g1q/yMC8A+DkLWMHvrHIqnVSkj 0BZg== X-Gm-Message-State: ALyK8tIF4L9mgHiCIKExCpIijMHb/wkMhEG79uooVSIyi14m1mfYP756HS3G4GZATLgypg== 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 Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.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);