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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7529BC05027 for ; Mon, 20 Feb 2023 05:59:56 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5819E8585F; Mon, 20 Feb 2023 06:59:54 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=sholland.org header.i=@sholland.org header.b="hcnoIHSY"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="kUSZeXfZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0B66685851; Mon, 20 Feb 2023 06:59:52 +0100 (CET) Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 81D67857E0 for ; Mon, 20 Feb 2023 06:59:47 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=sholland.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=samuel@sholland.org Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 05C803200C9B; Mon, 20 Feb 2023 00:59:44 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 20 Feb 2023 00:59:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= cc:cc:content-transfer-encoding:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to; s=fm2; t=1676872784; x=1676959184; bh=4L Nw/xTr4QsO3ghRg7KOLiZx/0McyP5TIQHuzdUkz2o=; b=hcnoIHSYDCE27b7w7u LdHJAL7/mH4MkvP3lZJhqpZvBO3/WjW9m+ik1dVnsMWdiLOpe0knsWEzLG/kCNuh Efn8GRFW2JbTDvLYmFWn/CxWZu9RU97MafEaQ21lo/KtbpePTQHxl+QCUxDuINou DuybSSHv4sXFqKnxTs68fHESRQR7P/+6lAW0lbHl8kUNiDD6jhMH0f4nWPtt8YDv it+4nfGMe9wWKOML+J6BKmfjp7SZe5E4z9W47uNqzQ5uEY14b2pQ4FbBDuNOx6It TFjUW+zyqrdmc9Ih/5tHDxY4LAoXzyJgswCK2vVpBag5Ip4Nh57IDCCZsSJgeC0V lm7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1676872784; x=1676959184; bh=4LNw/xTr4QsO3 ghRg7KOLiZx/0McyP5TIQHuzdUkz2o=; b=kUSZeXfZGxRvt+2VPMwkCxR+RaBbc FsLxoVz3q4a0i4Sz+gpnwgQztyxj2WBIqhZIv53AjY5Fu9ARqfM+tnLJx5cqxvBb KWYo0+9Xct5If1e6xPlt+rlFvJh4HLhwtzRzLGh3PdDzU4NX/4gOvRGjMZGxIlnV V+vwOPyMM+QTE45kx2FFfsH2iTqijDiSdwEk68/tthvSIsZ5VJ3L75U2LRWMCBBE Q0bwM6M4c/mTuWKKq7CWn5vPqAnNVrDnYfneCgcqLJFJuqAMpdl0z3tA+0NKHmfC qoLrtjOptQ2nBN6gP0+mUK98f0ARt4679I14iPDgnh3GYLYUFlyvfPtYQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudejgedgkeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufgrmhhu vghlucfjohhllhgrnhguuceoshgrmhhuvghlsehshhholhhlrghnugdrohhrgheqnecugg ftrfgrthhtvghrnhepudekteeuudehtdelteevgfduvddvjefhfedulefgudevgeeghefg udefiedtveetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrh homhepshgrmhhuvghlsehshhholhhlrghnugdrohhrgh X-ME-Proxy: Feedback-ID: i0ad843c9:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Feb 2023 00:59:43 -0500 (EST) From: Samuel Holland To: Lukasz Majewski , Sean Anderson , Simon Glass Cc: Samuel Holland , Dario Binacchi , Jean-Jacques Hiblot , Michal Suchanek , Neil Armstrong , Peng Fan , u-boot@lists.denx.de Subject: [PATCH 1/6] clk: Handle error pointers in clk_valid() Date: Sun, 19 Feb 2023 23:59:34 -0600 Message-Id: <20230220055940.41890-2-samuel@sholland.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230220055940.41890-1-samuel@sholland.org> References: <20230220055940.41890-1-samuel@sholland.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Some clk uclass functions, such as devm_clk_get() and clk_get_parent(), return error pointers. clk_valid() should not consider these pointers to be valid. Fixes: 8a1661f20e6c ("drivers: clk: Handle gracefully NULL pointers") Signed-off-by: Samuel Holland --- include/clk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/clk.h b/include/clk.h index d91285235f7..4acb878ec6d 100644 --- a/include/clk.h +++ b/include/clk.h @@ -671,7 +671,7 @@ static inline bool clk_dev_binded(struct clk *clk) */ static inline bool clk_valid(struct clk *clk) { - return clk && !!clk->dev; + return clk && !IS_ERR(clk) && !!clk->dev; } int soc_clk_dump(void); -- 2.39.2