From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A020C433FE for ; Thu, 19 May 2022 12:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237770AbiESMNQ (ORCPT ); Thu, 19 May 2022 08:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237727AbiESMNC (ORCPT ); Thu, 19 May 2022 08:13:02 -0400 Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::221]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F6F6BFE7; Thu, 19 May 2022 05:12:57 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A1931240011; Thu, 19 May 2022 12:12:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1652962376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YdYYUpD3AWSzDg3ucW4PZuX/tknffoSqqCf8c/4+U+k=; b=kU5oxW180FvZkjXu5vKUBj1nf/DgJchWR+wQZ+IPlcWZShi0dfMcthr/C3pHZb873WxKo2 V6Je//tx1VlAmvZp4cOotGh1Zmjb3kN2Oa6w0YbwaJar4yRuiRlw6Gb1ofo2BPsoZBqiD+ dtod5npdS7Ql95q1HT1AELu8c1xDumacm1MqylmmlRLEY9vWh98M+FMqh8bgkJXOQjdvAm EwBEyHsIKyUp5K9osbwUa+LS885yM/xdR86lv8r3+swAw9gruqgOtQhLtW8BxibJ8jsq5j +0QKqZKFkdP3JUkVC1w0DfIe8VmaY9qO9c8drNwcXrMo5kzKTAMTm250Dl3Yuw== Date: Thu, 19 May 2022 14:12:52 +0200 From: Miquel Raynal To: Colin Ian King Cc: Alessandro Zummo , Alexandre Belloni , Michel Pollet , linux-rtc@vger.kernel.org, linux-renesas-soc@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] rtc: rzn1: Fix uninitialized variable val Message-ID: <20220519141252.7b24d522@xps-13> In-Reply-To: <20220519100641.595608-1-colin.i.king@gmail.com> References: <20220519100641.595608-1-colin.i.king@gmail.com> Organization: Bootlin X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Colin, colin.i.king@gmail.com wrote on Thu, 19 May 2022 11:06:41 +0100: > Variable val is not being initialized and is later being read with > a potentially garbage value. Fix this by initializing val to zero. >=20 > Detected by clang scan build: > warning: variable 'val' is uninitialized when used here [-Wuninitialized] >=20 > Fixes: deeb4b5393e1 ("rtc: rzn1: Add new RTC driver") > Signed-off-by: Colin Ian King > --- > drivers/rtc/rtc-rzn1.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c > index 980ade8c9601..0b4bf6e43464 100644 > --- a/drivers/rtc/rtc-rzn1.c > +++ b/drivers/rtc/rtc-rzn1.c > @@ -272,7 +272,7 @@ static int rzn1_rtc_set_offset(struct device *dev, lo= ng offset) > struct rzn1_rtc *rtc =3D dev_get_drvdata(dev); > unsigned int steps; > int stepsh, stepsl; > - u32 val; > + u32 val =3D 0; There are actually two variables mixed together. "val" is used both for the readl_poll_timeout() call (where it should be a dedicated 'ctl2' variable) and for the subu register which is written at the end. This variable could be renamed 'subu' and initialized to 0 as you did. Thanks, Miqu=C3=A8l