From patchwork Tue Jun 28 14:02:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 12898329 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 6353CC433EF for ; Tue, 28 Jun 2022 13:54:19 +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=TLpXLGl/CH7UQ3n0pgf8opSLiiinZR1FKbrxMvX14Vk=; b=dex/jPfbBS/cSs 4tmamrFLHYkq/BJD/2zUAgGUBl4N5ikS9V1TsMFMdp9eirjA4/8UjoIp/p8L0uM+DUxD+Oon9Exb9 KEyTMPtToF+Xgra6kWgEtN5KO10oIzXZez989wDi3P0clZ4eQSHhUlaey4KoILQYfL7Y8c+eTF4PP zVih0grHoDNtc40YASqbUxVcA1Kj2FrOvP2VYt4pIILyEgEj1bF39KjoDVAGtfEqiGlNj86CCvrZQ g1Y5X6KQMZXOfhHhGFNd8oqXjk+3K1hM42Ysaoft6774OnBzLyvE/D/6+DElrmMUSsvFKI+r6TVQm wgNVGXvN//tDm74DmhPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6Bea-006Y0i-0C; Tue, 28 Jun 2022 13:53:20 +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 1o6BeL-006Xrm-HY for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2022 13:53:08 +0000 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXQwM1s9YzdZtk; Tue, 28 Jun 2022 21:50:43 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:52:58 +0800 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.24; Tue, 28 Jun 2022 21:52:58 +0800 From: Yang Yingliang To: , , CC: , , Subject: [PATCH -next 1/2] soc: fsl: guts: fix return value check in fsl_guts_init() Date: Tue, 28 Jun 2022 22:02:48 +0800 Message-ID: <20220628140249.1073809-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: dggems701-chm.china.huawei.com (10.3.19.178) 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-20220628_065305_828887_44819B1F X-CRM114-Status: GOOD ( 11.65 ) 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, of_iomap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test and return -ENOMEM as error value. Fixes: ab4988d6a393 ("soc: fsl: guts: embed fsl_guts_get_svr() in probe()") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Reviewed-by: Michael Walle --- drivers/soc/fsl/guts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 27035de062f8..8038c599ad83 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -195,9 +195,9 @@ static int __init fsl_guts_init(void) soc_data = match->data; regs = of_iomap(np, 0); - if (IS_ERR(regs)) { + if (!regs) { of_node_put(np); - return PTR_ERR(regs); + return -ENOMEM; } little_endian = of_property_read_bool(np, "little-endian");