Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5001436rwb; Sun, 13 Nov 2022 19:15:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7rENsrP0orTyVIZkSRn3c1Q85YrZTppMtkPzKXnZez1uSfUAm8d39wMuRBk32Bg+ByIC43 X-Received: by 2002:a50:9503:0:b0:457:1edb:996c with SMTP id u3-20020a509503000000b004571edb996cmr9653393eda.363.1668395757735; Sun, 13 Nov 2022 19:15:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668395757; cv=none; d=google.com; s=arc-20160816; b=Lnb/P+52ZKv9NHwJFKeoL7M1STtyrM3txvzyp1ZTbor+SgdjF+ebjSCeVh7Z9HAsQe hb4ox4XmyzJI9Au+g/Xjoj3YTKEQelm0yP5uocsR88ZtNit60PhNVHpnkXShQ+NfPjmk pZSg3yXSKR0qiMUG46NnEARJHv487MswLbKOhIBTbum8zGYqqq8rEqENCd0kl8t+p/NN rJoW83kHKMdN6iHlqpyGfi1BYHFazYtWoZJOKJDbv/dBhwj5aFj44A8Lt0rZv9HvllyC UORzGaQ1L1K9CClcsIKvQp9h4Mx3naXsnQ2WCGghQAGaZG7fU9my+DuREi/HxeXKjK4R iYBA== 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=7BIK9BNCAAhEIwruuTFnZwTTE6B2mkt8qqiUhpTccoQ=; b=w56yQToCavqlMRyDhA6N8H2hdhQ3ppv9PEtQZ0HGB5n2yEJjhYj2cHzwXIIC56dR+3 xgM4wwB4WUpBmYtzoP48Vrc4uxoWKpsJ7eCbXuvi6MtjgH2Kh8WiNOiscAXA75Ibg7Vv QsXtC92lNYmwc6FfGb7cEMYhfUDUyqehfW0wBhhMsQG4V2ydOZmPSd9B/k3pvrlVPkNf crs5iBnig/VfGOiockjV7ReBFUt+SJD9LqjLF62G6Dck990BlBVKnjrOI9Udi+dBfO1r 5E81zlzrqKBzc9X8rOKRhrGsM0AYTxaufXB19cDr+r+M3rzLFFZrjQ88vFa8XCLug6jS 44pw== 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 b10-20020a056402278a00b00459c1e64776si9368612ede.412.2022.11.13.19.15.36; Sun, 13 Nov 2022 19:15:57 -0800 (PST) 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 S235688AbiKNC71 (ORCPT + 89 others); Sun, 13 Nov 2022 21:59:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233909AbiKNC70 (ORCPT ); Sun, 13 Nov 2022 21:59:26 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E6EF13D76 for ; Sun, 13 Nov 2022 18:59:25 -0800 (PST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N9Yt61yJ6zHvvb; Mon, 14 Nov 2022 10:58:54 +0800 (CST) Received: from cgs.huawei.com (10.244.148.83) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 14 Nov 2022 10:59:22 +0800 From: Gaosheng Cui To: , , , , CC: Subject: [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe() Date: Mon, 14 Nov 2022 10:59:21 +0800 Message-ID: <20221114025921.1194834-1-cuigaosheng1@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.244.148.83] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500012.china.huawei.com (7.221.188.12) 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 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 The svc_create_memory_pool() returns an ERR_PTR() on failure, we should use IS_ERR() to check the return value, and return it on failure. Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver") Signed-off-by: Gaosheng Cui --- drivers/firmware/stratix10-svc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index b4081f4d88a3..64e430c6f14a 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -1133,8 +1133,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev) return ret; genpool = svc_create_memory_pool(pdev, sh_memory); - if (!genpool) - return -ENOMEM; + if (IS_ERR(genpool)) + return PTR_ERR(genpool); /* allocate service controller and supporting channel */ controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL); -- 2.25.1