Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6439782rdb; Tue, 2 Jan 2024 01:42:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFia1dmSeNRWYSFdeAiVYg0q+Dk3XmQ3kdBttseM6SWvzK7uMZJ3Vm0wZTJNfNFI6e1Xvbw X-Received: by 2002:a50:ccc1:0:b0:547:9f26:e581 with SMTP id b1-20020a50ccc1000000b005479f26e581mr10314357edj.37.1704188531790; Tue, 02 Jan 2024 01:42:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704188531; cv=none; d=google.com; s=arc-20160816; b=n/kCoxoZfAirq5CdRjIALtSWtuMvk0xwbme5azw4hyv1CwAtCzrnNT9vXRfOb3o7pa 9FM5zNZS7yXeEUYwOtU39rWw69Gc8A2gWoGVWCkIBFMhBmKD1cqUTULDJzh1Wz90ZTzC eKVcbEEZdWjJfNw3LD3J7Bdwv4vsV5jlWp10NxlIBS90SPb889qZE/96PJY4z6YAjdat 399rOVs7+rynwrhlies2IiLv/HJZdA1FgYPzgoCkWZJAoY1NbCmRy8s8++/t0hcTod6V tyx3/6CHCKDWtPQvsWBMETBpMBlrAnXHS8QPRq1EJBcml0bYX/5ovfyXx/UWYMJHr+zA O4mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=AtfKsUW5r6pYokxSXrqiO4WYhyFo2FSa/0ioZZfgWv8=; fh=hNwPqD9quIFNIXx9YTPGvj7TT2yrBA50/BJIyOf0IdE=; b=BwvcqG+ACLF485tIA1HjZ2/Q6MltMDKejwC9hKW6DqrenqD3Jeux6WN77u5RCPrI9n YGuyHha7XQ1HcsPPhZnQAcASmvyHuAj/IGGJINZiKTU0qCk36D1PqlBp2FyXYx37T0wK hyAqoQzS437ZWnx8NL5Ag/osSEfNB1AsPD32QVqt+z1iz03DReoCKCe8IOBeUaImNuJO stDwBAGsfdKe8R1Y+GOTNLMAyX7+yO6nLXxYL9fReTPfNZ5B+f07qe+N8JG+KtEJVGy2 PfoeLBrgnLUxO53NVS0jBusATZi0wQnbXSnBemuBUj1tIYE6xYGd27RP2oBBtX0iyplu VNmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=vwpbM4Ek; spf=pass (google.com: domain of linux-kernel+bounces-14200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 21-20020a508e15000000b0055469363fe7si9563841edw.370.2024.01.02.01.42.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 01:42:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=vwpbM4Ek; spf=pass (google.com: domain of linux-kernel+bounces-14200-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14200-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 834461F2112C for ; Tue, 2 Jan 2024 09:42:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5594D746B; Tue, 2 Jan 2024 09:41:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="vwpbM4Ek" X-Original-To: linux-kernel@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3E7CDD27F; Tue, 2 Jan 2024 09:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704188507; bh=FyLks047y5EHUM2OKY0gTkVd8p2xO2+y8kTMjKFijSg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=vwpbM4EknSe+s+iyX71PYvZayhxWo+dUMoNsHsri18wj1l3ZS3hUxt9FFhZjr6tto IC/7DUykfGCRE7vgGNQfeldwcVLsSRHO9HC37m/GO7h9P9wY9RKAlcU0kaguoFaX9r 3N3EzQbhdspbUtxvcJL7oehKuNPcUmSMvaE519+uZ4AXEJZJ472+3cHFuBWJIgg81c R+XEmQz0hJMnn8MR5aIqAMxawvkyhlKy87lz5OUv0CQsBia6AGxKyiKgcnuYM2YJya iqrngmitpclR0jCLy4wsH2RWqdpcze3Wpwp5jo23rTr8I5Vx32hfDJbm/PO4s+s66F DLxraCut+Yl3A== Received: from [100.113.186.2] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A82E63781433; Tue, 2 Jan 2024 09:41:46 +0000 (UTC) Message-ID: <0bfa27e8-c173-4a2a-b453-9289f2eb1926@collabora.com> Date: Tue, 2 Jan 2024 10:41:45 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] clk: mediatek: fix cppcheck error for uninitialized variable Content-Language: en-US To: mturquette@baylibre.com, sboyd@kernel.org, matthias.bgg@gmail.com, kishan.dudhatra@siliconsignals.io Cc: Chen-Yu Tsai , Tom Rix , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20231225152806.3716898-1-user@falcon> From: AngeloGioacchino Del Regno In-Reply-To: <20231225152806.3716898-1-user@falcon> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 25/12/23 16:28, ha scritto: > From: Kishan Dudhatra > > cppcheck reports below warning > > clk/mediatek/clk-fhctl.c:206:27: > error: Uninitialized variable: pll_postdiv [uninitvar] > if (postdiv && postdiv < pll_postdiv) > > This is due to uninitialization of variable pll_postdiv, > which is now initialized as part of this patch. > > Signed-off-by: Kishan Dudhatra This is a false positive... the pll_postdiv variable is *always* used and *only if* postdiv > 0. P.S.: There was some problem with your email, as the From entry is empty. Regards, Angelo > > diff --git a/drivers/clk/mediatek/clk-fhctl.c b/drivers/clk/mediatek/clk-fhctl.c > index 33b6ad8fdc2e..b0e71e4fd938 100644 > --- a/drivers/clk/mediatek/clk-fhctl.c > +++ b/drivers/clk/mediatek/clk-fhctl.c > @@ -186,7 +186,7 @@ static int fhctl_hopping(struct mtk_fh *fh, unsigned int new_dds, > struct fh_pll_regs *regs = &fh->regs; > struct mtk_clk_pll *pll = &fh->clk_pll; > spinlock_t *lock = fh->lock; > - unsigned int pll_postdiv; > + unsigned int pll_postdiv = 0; > unsigned long flags = 0; > int ret; >