Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6017407pxv; Thu, 29 Jul 2021 04:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDl8Io9/E6ubejA9Y4Sg1JUDIoocNRdIC44U1VC3g7FGdtRKkg6ULfOBXiB/VHABP3wN28 X-Received: by 2002:a05:6402:7c9:: with SMTP id u9mr5489153edy.387.1627558266611; Thu, 29 Jul 2021 04:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627558266; cv=none; d=google.com; s=arc-20160816; b=GEoGK4wS4Djq+t9MKCFpY3NfVTNTV87sWRfQhm8zRmoMORuVW+VN7FeUqelBTRKHV4 XsyR4Cp39OCaJ3QptQliNunbu9EVnwq4z+I00sFaQehNEdgkiro6UbjOWeEQLYLBBkLB 5ra/ttCdK6oANdbKBB+pDwDrhI+i6mMmLznnMM9nWdzG+4EIB6smOThy+KA69rPKg8sR 5ixbMp+f41I16+iABOJ3Sz4yuc7sDnbOL6Aoj3C7IzgLTjZqHryU2zUS4xdnzWCwGW3Y VQJqsg1V0reZf8eq8eaCx3/h7R6WiMxFHfaLDDgr3dQ3Q+mg2LXuSbxRm2FMMKYrbeTS XiRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=JZvr36eYs5K8QD7G1xx+r8gNCAKvBUm1LSt1CwnKA/M=; b=LsAWUPy1UAe0diBiwKdNM97l2ILvvsOkFxE1YT9ggTqz0LjgZTnAn7Ksjf0RnU7+14 nYWUbKvvO2tr+LUo4kmApvmNIDWkLuvzoR85rVYAVaJcBR/tfX7DDNmdMw4jlCOgxmD0 nPZYZfJk2LmReJKUgwo24maGeO5Fvm+tG+KW8NI8ooCrobIBbbX0zQpWigiFGfevqdrQ m19SRNWwLfsNBXXOBx/nFbfle3vlVz62j0k7VbOptnVo6KOIK+eJHJdKFX8m0d7jXxsF 3kcU307i3SJaDoSNmZIV3UqMuOs7MbKoCi0zdG0VRJ98iiWXvNgc0Pfc5O0wgjU0vMco dv8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bq17si3019818ejb.353.2021.07.29.04.30.43; Thu, 29 Jul 2021 04:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236414AbhG2L1u (ORCPT + 99 others); Thu, 29 Jul 2021 07:27:50 -0400 Received: from smtp03.smtpout.orange.fr ([80.12.242.125]:40498 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234105AbhG2L1t (ORCPT ); Thu, 29 Jul 2021 07:27:49 -0400 Received: from localhost.localdomain ([86.243.172.93]) by mwinf5d05 with ME id azTi2500F21Fzsu03zTjaB; Thu, 29 Jul 2021 13:27:44 +0200 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 29 Jul 2021 13:27:44 +0200 X-ME-IP: 86.243.172.93 From: Christophe JAILLET To: wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net, kuba@kernel.org, angelo@kernel-space.org Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] can: flexcan: Fix an uninitialized variable issue Date: Thu, 29 Jul 2021 13:27:42 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If both 'clk_ipg' and 'clk_per' are NULL, we return an un-init value. So set 'err' to 0, to return success in such a case. Fixes: d9cead75b1c6 ("can: flexcan: add mcf5441x support") Signed-off-by: Christophe JAILLET --- Another way to fix it is to remove the NULL checks for 'clk_ipg' and 'clk_per' that been added in commit d9cead75b1c6. They look useless to me because 'clk_prepare_enable()' returns 0 if it is passed a NULL pointer. Having these explicit tests is maybe informational (i.e. these pointers can really be NULL) or have been added to silent a compiler or a static checker. So, in case, I've left the tests and just fixed the un-init 'err' variable issue. --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index 54ffb796a320..7734229aa078 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -649,7 +649,7 @@ static inline void flexcan_error_irq_disable(const struct flexcan_priv *priv) static int flexcan_clks_enable(const struct flexcan_priv *priv) { - int err; + int err = 0; if (priv->clk_ipg) { err = clk_prepare_enable(priv->clk_ipg); -- 2.30.2