[PATCH -next] coresight: ultrasoc-smb: fix return value check in smb_init_data_buffer()

Yang Yingliang yangyingliang at huawei.com
Tue Jan 17 23:49:20 PST 2023


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 <yangyingliang at huawei.com>
---
 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;
 	}
-- 
2.25.1




More information about the linux-arm-kernel mailing list