From patchwork Thu Sep 20 06:21:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10607031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8F6DA1508 for ; Thu, 20 Sep 2018 06:25:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E8402AC58 for ; Thu, 20 Sep 2018 06:25:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 728422ACAA; Thu, 20 Sep 2018 06:25:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13AD32AC58 for ; Thu, 20 Sep 2018 06:25:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject: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=gKcBSpGZSDbyVGQrLKpFBDQOs1iIgZ9ixCz+YmDo+eI=; b=smuuEQZYZ2el5C dE0zPoWjLm6O9UMM+MMBwVNWe6MOUJa7LSgVw0s4S8kGhUk/rPEFsL9vxFLE3+OVHVA5SeOfDxlau lo5akIFs7itqjXjDadnH2rAf+kEZNq6bjsS63AHOOhVrIcqemKaZQVM5vWTgH12aXkS8cQXEJAMva ipa5FbEOiPeFAf+gEL2FcWGWrUnJr0to5QxKj55RHzCrtBmyiMCzdpXGxCKFoLVvjwh3KQxZOCBkK LGcN9c6YiSfd1+91WkoikZA6bl2uphqc67GeernAhHTchMNH3r7G5LGOAvQHh6fgQUPyCT+MQxwm5 D4qqON3pY7k8D7lh1poA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2sOz-0007NZ-NZ; Thu, 20 Sep 2018 06:25:25 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2sNo-0005zc-Nl; Thu, 20 Sep 2018 06:24:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=MIME-Version:Content-Transfer-Encoding: Content-Type:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=1cEd8iTAoXR+STYh7VP23wHZ+I3D/KG7q5eO2dzZPbY=; b=nGpziFBO9vCLXhJqMX9tJ07X+X Kd++euE26clEGJSHcXx+6aPXNT0zK1M5BV6gzlxSoxJb2DV5YxtyBvOyvHanw2TbDVUNmN/W/60YN M+6lbE+o08n8lyjSCewLPKmcV1f9E5Jj7MXr7TB4tn+uMLT8m1qYLWGt/NGGoGqCb24keChBWSMxc fv+8BO9kSlgKDWbmjWPNzaat9BVsK8vtNt0wrLjYh5vL/AcsZKLtSg6uhs2AsmHggQ3IxHir3B2E+ 3OuplOWSLp7FKTVkllBQ8GaE3d5a4z24Ze5pVI63H3iXWnUSdQ5X+lNMi1Ovigk4WEaF+esbH2JEK R91iVBIA==; Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2sCP-0006hR-9g; Thu, 20 Sep 2018 06:12:27 +0000 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 8302C8F01116E; Thu, 20 Sep 2018 14:12:03 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 14:11:54 +0800 From: Wei Yongjun To: Linus Walleij , Matthias Brugger , Sean Wang , Zhiyong Tao Subject: [PATCH -next] pinctrl: mediatek: paris: fix return value check in mtk_paris_pinctrl_probe() Date: Thu, 20 Sep 2018 06:21:28 +0000 Message-ID: <1537424488-23485-1-git-send-email-weiyongjun1@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180920_071225_637902_D0F5B914 X-CRM114-Status: GOOD ( 11.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-mediatek@lists.infradead.org, Wei Yongjun , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP In case of error, the function devm_kmalloc_array() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings") Signed-off-by: Wei Yongjun Acked-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-paris.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c index 4cf0fea..d217902 100644 --- a/drivers/pinctrl/mediatek/pinctrl-paris.c +++ b/drivers/pinctrl/mediatek/pinctrl-paris.c @@ -836,8 +836,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, hw->base = devm_kmalloc_array(&pdev->dev, hw->soc->nbase_names, sizeof(*hw->base), GFP_KERNEL); - if (IS_ERR(hw->base)) - return PTR_ERR(hw->base); + if (!hw->base) + return -ENOMEM; for (i = 0; i < hw->soc->nbase_names; i++) { res = platform_get_resource_byname(pdev, IORESOURCE_MEM, @@ -863,8 +863,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, /* Copy from internal struct mtk_pin_desc to register to the core */ pins = devm_kmalloc_array(&pdev->dev, hw->soc->npins, sizeof(*pins), GFP_KERNEL); - if (IS_ERR(pins)) - return PTR_ERR(pins); + if (!pins) + return -ENOMEM; for (i = 0; i < hw->soc->npins; i++) { pins[i].number = hw->soc->pins[i].number;