From patchwork Thu Sep 20 06:21:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 10606997 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 E0316913 for ; Thu, 20 Sep 2018 06:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE6342AC60 for ; Thu, 20 Sep 2018 06:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C262E2AD9B; Thu, 20 Sep 2018 06:24:36 +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 2E9C22AC60 for ; Thu, 20 Sep 2018 06:24:36 +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=3qbdVliUEOpP0xR9DlNnR2vuu+tjYzfLtxsMkPoYtXY=; b=S6oMohxm52/WYV radkbBudzj9fvxGTayueJhRJFoJp3xqacAdw3xG39vwIhbp9FJiGK2bruSSfEjhsU+J9Ys0L+XjPx RpDn05WSsZFOTZ3m0OKiFnxV/d33MvAvKd2oppFbgS/JfVuqbXBHM0xuKxazZl//02Xug1b9//jC6 yZJRvErCUAm0sYw/mOxnLNLMFwWWadTPVMKDppltdCE6fqHPead/Lb9qjeB/Y+hKnASDFLgGaB1Q2 ATTSxDWGWgYU4XzFBZ9xTRMnAn6UmbK+9cb9ujRR3y9ohVVvckbJoXdwqhSTIDxRypgHka+Y0Ccfa FsTl8iD67opJ2A0mrG4w==; 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 1g2sNs-00069Q-Gz; Thu, 20 Sep 2018 06:24:16 +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-0005u8-FE; 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=pDNy4Z8lSzE0rVWSrp2VgAoYRsMLZYah6TGZMSX0ReU=; b=dKmX1S17qbNzq6YpnNfJW1XRVx 2jhuSLr4T7bZt1NJ/FAytxV3XBGzI4c93bIFipZkKBu2ILCAHL6SVQU6n0HEQRBu7pzA4lZh/hKB8 ZZtq+FgEPeU0prxXn14JkhScrZyUgYeeWkg3RNdP6/6dQaQc79zMsbXmC7gbAqbYxgFCWyN8c7Y7Y F6eiaNBOWyhINIP52Oyzn5td6wFWB7ihE4GKWwGrvVRmuH0pg56wFmuK/6WTyABfBrdwbdnIKT7xx /xoly0+hqMeynPYzZDAS1lpeayohSjYh0HsnUDM1xqiQ5qUZDV5yVfxDJbRUL1T4GGsK3rrGkKd7K nfiCEgYw==; Received: from szxga06-in.huawei.com ([45.249.212.32] helo=huawei.com) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2sCb-0006k7-MC; Thu, 20 Sep 2018 06:12:39 +0000 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id AED9D13F818E8; Thu, 20 Sep 2018 14:12:20 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.399.0; Thu, 20 Sep 2018 14:12:14 +0800 From: Wei Yongjun To: Linus Walleij , Matthias Brugger , Sean Wang , Ryder.Lee Subject: [PATCH -next] pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe() Date: Thu, 20 Sep 2018 06:21:50 +0000 Message-ID: <1537424510-23623-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_071238_044322_0F29EB0B X-CRM114-Status: GOOD ( 11.65 ) 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: b7d7f9eeca55 ("pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on") Signed-off-by: Wei Yongjun Acked-by: Sean Wang Acked-by: Sean Wang --- drivers/pinctrl/mediatek/pinctrl-moore.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pinctrl/mediatek/pinctrl-moore.c b/drivers/pinctrl/mediatek/pinctrl-moore.c index c27597c..3bf5dd5 100644 --- a/drivers/pinctrl/mediatek/pinctrl-moore.c +++ b/drivers/pinctrl/mediatek/pinctrl-moore.c @@ -608,8 +608,8 @@ int mtk_moore_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, @@ -629,8 +629,8 @@ int mtk_moore_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;