diff mbox

drm: Fix return value check in kirin_drm_platform_probe()

Message ID 1507720636-129038-1-git-send-email-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Yongjun Oct. 11, 2017, 11:17 a.m. UTC
In case of error, the function of_graph_get_remote_node() returns NULL
pointer not ERR_PTR(). The IS_ERR() test in the return value check
should be replaced with NULL test..

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sean Paul Oct. 12, 2017, 2:42 p.m. UTC | #1
On Thu, Oct 12, 2017 at 2:39 AM, Gabriel Krisman Bertazi
<krisman@collabora.co.uk> wrote:
> Wei Yongjun <weiyongjun1@huawei.com> writes:
>
>> In case of error, the function of_graph_get_remote_node() returns NULL
>> pointer not ERR_PTR(). The IS_ERR() test in the return value check
>> should be replaced with NULL test..
>
> Looks good.
>
> Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
>

FYI, I just noticed Dan Carpenter sent an identical patch last week
"<20171005125751.jvtjms62vbtxuvak@mwanda> [PATCH] drm/kirin: Checking
for IS_ERR() instead of NULL".

I'll add my R-b there, since it was first.

Sean


> --
> Gabriel Krisman Bertazi
diff mbox

Patch

diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
index e27352c..527aa58 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c
@@ -236,8 +236,8 @@  static int kirin_drm_platform_probe(struct platform_device *pdev)
 	}
 
 	remote = of_graph_get_remote_node(np, 0, 0);
-	if (IS_ERR(remote))
-		return PTR_ERR(remote);
+	if (!remote)
+		return -ENODEV;
 
 	drm_of_component_match_add(dev, &match, compare_of, remote);
 	of_node_put(remote);