From nobody Fri Sep 19 05:37:03 2025 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 00201C433FE for ; Mon, 28 Nov 2022 08:40:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbiK1IkS (ORCPT ); Mon, 28 Nov 2022 03:40:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbiK1IkO (ORCPT ); Mon, 28 Nov 2022 03:40:14 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5371A17A82 for ; Mon, 28 Nov 2022 00:40:07 -0800 (PST) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NLJhj0tSlzqT1P; Mon, 28 Nov 2022 16:36:05 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 28 Nov 2022 16:40:05 +0800 From: Zheng Yongjun To: , , , CC: , , Subject: [PATCH v2] soc: imx8m: Fix return value check in imx8mq_soc_revision() Date: Mon, 28 Nov 2022 08:37:55 +0000 Message-ID: <20221128083755.80445-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In case of error, the function of_clk_get_by_name() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: 836fb30949d9 ("soc: imx8m: Enable OCOTP clock before reading the reg= ister") Signed-off-by: Zheng Yongjun Reviewed-by: Ahmad Fatoum --- Changes in v2: - Rewrite code and make it more concise. 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 =3D of_iomap(np, 0); WARN_ON(!ocotp_base); clk =3D of_clk_get_by_name(np, NULL); - if (!clk) { - WARN_ON(!clk); + if (WARN_ON(IS_ERR(clk))) return 0; - } clk_prepare_enable(clk); -- 2.17.1