From patchwork Wed Jan 18 07:49:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Yingliang X-Patchwork-Id: 13105763 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 18565C004D4 for ; Wed, 18 Jan 2023 07:38:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=szP6rPvatWin7G4UUSR+zRlO7Xe4pkxFE6t2ba9WOBE=; b=uyhirU2vixQKR+ 5VvXEYKe9WrY4oY7jQqWeY7jR4dS8LJ2kywLZwNrXKSY3cikhVvjLTyp//cBz72AmKhA29NVIehw3 KWb1Q1pbVOxfTbEaf/OAyTIl7iXyZOrjVTfLqLwASKcznz02pda0kp2orm3ilJV/VLX/Jk7q9A4WF 9lyAgP30E5qPD494HR90k23dyGtvhF56Wsf/wrIdyxw6uWvpxm+6epUIJEueRsXH3hx0HUW42jlmw xCoTbIbyQ7JicaqcNh0p2DKr20HvwE+8xqAwzQpQtVoj1FX5PGahXtExYWXTiCg+/gAaBTC1fVPGr B4LEE7qObUjXo1yb7afw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI30D-00HGMK-0L; Wed, 18 Jan 2023 07:36:58 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pI2uz-00HDsg-DM for linux-arm-kernel@lists.infradead.org; Wed, 18 Jan 2023 07:31:35 +0000 Received: from dggpemm100007.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NxcpK2G1mzRrGG; Wed, 18 Jan 2023 15:29:29 +0800 (CST) Received: from huawei.com (10.175.103.91) by dggpemm100007.china.huawei.com (7.185.36.116) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 18 Jan 2023 15:31:21 +0800 From: Yang Yingliang To: , CC: , , , , , , , Subject: [PATCH -next] coresight: ultrasoc-smb: fix return value check in smb_init_data_buffer() Date: Wed, 18 Jan 2023 15:49:20 +0800 Message-ID: <20230118074920.1772141-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100007.china.huawei.com (7.185.36.116) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_233133_720547_DEC7FE49 X-CRM114-Status: GOOD ( 10.44 ) 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 platform_get_resource() returns NULL pointer not PTR_ERR(), replace the IS_ERR() check with NULL pointer check. Fixes: 06f5c2926aaa ("drivers/coresight: Add UltraSoc System Memory Buffer driver") Signed-off-by: Yang Yingliang --- drivers/hwtracing/coresight/ultrasoc-smb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/ultrasoc-smb.c b/drivers/hwtracing/coresight/ultrasoc-smb.c index 2560fdbb8ebf..b317342c7ce5 100644 --- a/drivers/hwtracing/coresight/ultrasoc-smb.c +++ b/drivers/hwtracing/coresight/ultrasoc-smb.c @@ -455,7 +455,7 @@ static int smb_init_data_buffer(struct platform_device *pdev, void *base; res = platform_get_resource(pdev, IORESOURCE_MEM, SMB_BUF_ADDR_RES); - if (IS_ERR(res)) { + if (!res) { dev_err(&pdev->dev, "SMB device failed to get resource\n"); return -EINVAL; }