From patchwork Tue Aug 20 13:28:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 13770106 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 07024C3DA4A for ; Tue, 20 Aug 2024 13:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding: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=VwTp4YE4OL4beXWU4hjZMkWWTG521Vo4qCm7rvlpWoA=; b=2ia69tXR8e+BF5crc6EjuR/oEI KuajqUH2tKzh+hurD2lvxXg9c3o8TboE2tK6KKDyF0ct3+r591JnGlp58f+pTCc6pNVPM9sZY1eiN ECcUX0osaDgDd2m/JfZ9Rijhq+GlzAG0HQzA4GQejXYXI6KG9cMc61bfRf3LX8IgNSnfBHvvkXM8O 02MTRykMbN/7BCImFq7FZGak64uRIaTM0DSQoxgBgzzdXlarMQUclis8K1Qb4IDOlSjFWLDdkDU/c zH11vbxv6N/7ZZ2p8b8YwzF47vynrujcDjBLye4qY245cYwmqyj2CL2B2chx4QobNHwG7uwgwvUYf mWwM4hZw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgOy3-00000005Np2-07aM; Tue, 20 Aug 2024 13:32:11 +0000 Received: from szxga05-in.huawei.com ([45.249.212.191]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgOxK-00000005Ngz-1mdv for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2024 13:31:28 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wp9GD1v8pz1j6q1; Tue, 20 Aug 2024 21:26:12 +0800 (CST) Received: from dggpemf500002.china.huawei.com (unknown [7.185.36.57]) by mail.maildlp.com (Postfix) with ESMTPS id EC1E51401F4; Tue, 20 Aug 2024 21:31:11 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpemf500002.china.huawei.com (7.185.36.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 20 Aug 2024 21:31:11 +0800 From: Yue Haibing To: , , , , , , CC: , , , Subject: [PATCH -next] dmaengine: xilinx: xdma: Fix NULL vs IS_ERR() bug Date: Tue, 20 Aug 2024 21:28:27 +0800 Message-ID: <20240820132827.52108-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemf500002.china.huawei.com (7.185.36.57) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240820_063126_760465_070CC138 X-CRM114-Status: UNSURE ( 9.61 ) X-CRM114-Notice: Please train this message. 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 devm_regmap_init_mmio() never returns NULL pointer, it will return ERR_PTR() when it fails, so check it with IS_ERR(). Fixes: 17ce252266c7 ("dmaengine: xilinx: xdma: Add xilinx xdma driver") Signed-off-by: Yue Haibing --- drivers/dma/xilinx/xdma.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c index 718842fdaf98..44fae351f0a0 100644 --- a/drivers/dma/xilinx/xdma.c +++ b/drivers/dma/xilinx/xdma.c @@ -1240,7 +1240,8 @@ static int xdma_probe(struct platform_device *pdev) xdev->rmap = devm_regmap_init_mmio(&pdev->dev, reg_base, &xdma_regmap_config); - if (!xdev->rmap) { + if (IS_ERR(xdev->rmap)) { + ret = PTR_ERR(xdev->rmap); xdma_err(xdev, "config regmap failed: %d", ret); goto failed; }