[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210301161210.823060139@linuxfoundation.org>
Date: Mon, 1 Mar 2021 17:05:54 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Wang Xiaojun <wangxiaojun11@...wei.com>,
Hulk Robot <hulkci@...wei.com>,
Jacopo Mondi <jacopo+renesas@...ndi.org>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Kieran Bingham <kieran.bingham+renesas@...asonboard.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.11 186/775] drm: rcar-du: Fix the return check of of_parse_phandle and of_find_device_by_node
From: Wang Xiaojun <wangxiaojun11@...wei.com>
[ Upstream commit 8d7d33f6be06f929ac2c5e8ea2323fec272790d4 ]
of_parse_phandle and of_find_device_by_node may return NULL
which cannot be checked by IS_ERR.
Fixes: 8de707aeb452 ("drm: rcar-du: kms: Initialize CMM instances")
Signed-off-by: Wang Xiaojun <wangxiaojun11@...wei.com>
Reported-by: Hulk Robot <hulkci@...wei.com>
Acked-by: Jacopo Mondi <jacopo+renesas@...ndi.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@...asonboard.com>
[Replace -ENODEV with -EINVAL]
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpu/drm/rcar-du/rcar_du_kms.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
index 72dda446355fe..7015e22872bbe 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
@@ -700,10 +700,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu)
int ret;
cmm = of_parse_phandle(np, "renesas,cmms", i);
- if (IS_ERR(cmm)) {
+ if (!cmm) {
dev_err(rcdu->dev,
"Failed to parse 'renesas,cmms' property\n");
- return PTR_ERR(cmm);
+ return -EINVAL;
}
if (!of_device_is_available(cmm)) {
@@ -713,10 +713,10 @@ static int rcar_du_cmm_init(struct rcar_du_device *rcdu)
}
pdev = of_find_device_by_node(cmm);
- if (IS_ERR(pdev)) {
+ if (!pdev) {
dev_err(rcdu->dev, "No device found for CMM%u\n", i);
of_node_put(cmm);
- return PTR_ERR(pdev);
+ return -EINVAL;
}
of_node_put(cmm);
--
2.27.0
Powered by blists - more mailing lists