Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4024414iog; Tue, 28 Jun 2022 07:34:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sV9XP45z2R9+5eZU9W/x3MEr5W04w03GBFPZ38AiQhZU5NnLCOML1XKJrd50o6gI6BA4oO X-Received: by 2002:a17:903:2305:b0:16a:73ce:90ca with SMTP id d5-20020a170903230500b0016a73ce90camr5046040plh.20.1656426846524; Tue, 28 Jun 2022 07:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656426846; cv=none; d=google.com; s=arc-20160816; b=OhVEMcmgoOZgvKO56mU15iKvaGc59sjWFXyCCGXVLQgMQXItVr2tWnp7j4U3HKcsOr bMkcdRjhSX2kkdTkHNlhFBxTl6L63qbltoFTc0z/uMqB07dVytmlxGyBFcaSDlLJlmfQ Qm3GCfyOmT9rDCzhXLVEFGK4i3lgHSSxWPBs/VAgFEc0+rSguY08O/on3KoYQvr2oK0h CoBJI7fZE+GD946txiQCSh7SgtMtUBbEtMqrDhA1grnj+fR4dNomiwqR96tCrcfSt6uP jeC0Gma8rJfOQ5xOJjoNqh1yc0Dp+ztV+EwpE/RydIAsERwfqmuZhPUauyJMJp9P1qYI c2zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7PMfIj0XtLuwL2aIWJ42ZF26tVPAQM4F2g+taSKBqFM=; b=FmnxXRJ9Xerg4ZBJhaDG1VX7vDxckWgMROUlUJNftORzhRmcpWsEOvnRVkcRORewqq rVfjpOo3H31GQqyW+u5rjEDysfoilQTRqMqzMXrh4iodL+5RxFRdPRJG191r9GlSnPYX f/y+mhco958cm9XsRMY0DL+/DJxH/0K3AvOsGy1IBiLiu3DsKdH88oOHRlqZPk0K+x19 zLEWkOgGMmoQEa0kjd+0lt9iBxR0e4ByVNCtC+5VqC25J2HXGSrzijUV3/DZo+8R8Irj gPVcOkh7VhDWw8goPooGJJtQbdq1zYguhJjO0XRNP6kbkOnqLejZw1wOFAP35JW+kA/o xCJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u6-20020a6540c6000000b0040cbcf5f997si11660536pgp.209.2022.06.28.07.33.33; Tue, 28 Jun 2022 07:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346971AbiF1NxI (ORCPT + 99 others); Tue, 28 Jun 2022 09:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346965AbiF1NxE (ORCPT ); Tue, 28 Jun 2022 09:53:04 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C879B25 for ; Tue, 28 Jun 2022 06:53:01 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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"); -- 2.25.1