From patchwork Wed Jan 4 09:27:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 13088450 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00862C4332F for ; Wed, 4 Jan 2023 10:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7fg7DUeXPYW+bzejlbJWr29TWxOfa+W20hwO9RGw1TI=; b=qDRG21ODo4hy0R vpUuXfUTyTaXMnxN0OyHR0Nety83cVF2h+FT6KbganvSEtSAfWPfe3unAYlAda4tZsfGg63BAWGcv A/bY9i4zsYUi9D2ed6PsEwHRfWZ67pkIGpGlGNaILAqS9yNHeNa63WqkKyt+XJa8IvifiB+5jG5He miMhjYAUC0HMFCmXNvpjYW8GV2k7/YERGg+vYN3pecSvK71dmT+aQpaYutLfAtrDSRMY2eC0jc0kc yanB9y3PPHDRqvOC08vbz6/UCA7I9+ydq/q2hmgvR+D0KSZwZaZA8WjOIx7eLAHJ0tht0TF5TC09d Y5IDHxRMP/3xASF8qE4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD12g-008OGz-7s; Wed, 04 Jan 2023 10:30:42 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pD0mj-008KyV-Rh for linux-arm-kernel@bombadil.infradead.org; Wed, 04 Jan 2023 10:14:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:In-Reply-To:References; bh=H7MNNw9240Mn6O1v6ZEufTkYEBWADtQs5w7s+NvXYvQ=; b=V/KKi/vrR2FljZ5HmF8nGSr4Ir PsVoP8YPgn8PXQu7qfW6KJn7dbtqwoU2+2iQJXT3dDsArwdU41jYDGBLGgMUOyhAINhuvGC/77yud kXQWf6QByIBjjrewzG+rrhcvV6DOvlTp7U1p9mEUFiKopoZXxI1Nh54+RB8hcBoIosEK//8AtIiMK xP6mBX8mvlwOShpbHCqj49QPPyNtQr9cvn2IISe61Vhl0UxD9tSwkiLav0ahZ2RxLoNOLtM1LNcJr 1K/UIyeFaSdfEw0dlKqqAawyVtKhZ0SfqJm+CYDY0mTaFdFaV6WZ33i//fgyz0nmeAfP0KR3jJgFj mmNUE8zg==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pCzlH-000rsO-31 for linux-arm-kernel@lists.infradead.org; Wed, 04 Jan 2023 09:08:42 +0000 Received: from dggpemm500007.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Nn3d83GcdzRqhm; Wed, 4 Jan 2023 17:06:52 +0800 (CST) Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 4 Jan 2023 17:08:23 +0800 From: Yang Yingliang To: , CC: , , , , , , , Subject: [PATCH v2] soc: imx8m: fix wrong return value check of of_clk_get_by_name() Date: Wed, 4 Jan 2023 17:27:02 +0800 Message-ID: <20230104092702.2553290-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500007.china.huawei.com (7.185.36.183) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230104_090840_534756_7A91B9D0 X-CRM114-Status: UNSURE ( 9.48 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org of_clk_get_by_name() never returns NULL pointer, it will return ERR_PTR() when it fails, so replace the check with IS_ERR(). Fixes: 836fb30949d9 ("soc: imx8m: Enable OCOTP clock before reading the register") Signed-off-by: Yang Yingliang --- v1 -> v2: Check WARN_ON() instead of checking IS_ERR(). --- drivers/soc/imx/soc-imx8m.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/soc/imx/soc-imx8m.c b/drivers/soc/imx/soc-imx8m.c index 28144c699b0c..d1dbe318be53 100644 --- a/drivers/soc/imx/soc-imx8m.c +++ b/drivers/soc/imx/soc-imx8m.c @@ -66,10 +66,8 @@ static u32 __init imx8mq_soc_revision(void) ocotp_base = of_iomap(np, 0); WARN_ON(!ocotp_base); clk = of_clk_get_by_name(np, NULL); - if (!clk) { - WARN_ON(!clk); + if (WARN_ON(IS_ERR(clk))) return 0; - } clk_prepare_enable(clk);