From patchwork Mon Nov 28 08:37:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Yongjun X-Patchwork-Id: 13057161 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 07867C433FE for ; Mon, 28 Nov 2022 08:41:10 +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=da2wWLR2R3FyAS6rch7PAqNbx3VFYaTWCz+tFyA0wno=; b=3jROSPArEQ0vDO FFiSLsxf3PqXnXNxAH7WUx0gJZTpTQbAIHLMMg36ZR9R6K+MYvZR10C5NKkNzXQ8XKiHL6kHD9ohV fZbmIYpv9s/Ud2lWMhhRujenfaeq4Cc5EdS3D95JKgWHT34VhBI37WPKTGRxNqNSIKZSjGofexinS m/hKDGF4/2vUE3Kxm7qarPu3lGsgfHUbW5LGjGjni2sAxPG15lcEjPqKj3bPj/EWxBamzXCS3ok/n KDQVJmoMrANPRxRxt32qAgRSNvCFxT9IgbdWhC4oHVus/e4vxxB9kUp+H6vTeswOa+LcSwthIfMC+ YM0netHUkimEjM7YpAgw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozZgZ-000JeX-Il; Mon, 28 Nov 2022 08:40:19 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ozZgT-000JZv-8z for linux-arm-kernel@lists.infradead.org; Mon, 28 Nov 2022 08:40:14 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221128_004013_533777_BEAFE519 X-CRM114-Status: GOOD ( 10.01 ) 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 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 register") 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(-) -- 2.17.1 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);