diff options
author | Wang Xiaojun <[email protected]> | 2020-11-11 11:14:52 +0800 |
---|---|---|
committer | Laurent Pinchart <[email protected]> | 2021-01-05 07:20:11 +0200 |
commit | 8d7d33f6be06f929ac2c5e8ea2323fec272790d4 (patch) | |
tree | 9523e642bbd4b13cac62e7f4a0e6cd59d4cac2eb | |
parent | 3a608bcbb97e70d18e330d3adb790ac1ac1a4aae (diff) |
drm: rcar-du: Fix the return check of of_parse_phandle and of_find_device_by_node
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 <[email protected]>
Reported-by: Hulk Robot <[email protected]>
Acked-by: Jacopo Mondi <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Reviewed-by: Kieran Bingham <[email protected]>
[Replace -ENODEV with -EINVAL]
Reviewed-by: Laurent Pinchart <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
-rw-r--r-- | drivers/gpu/drm/rcar-du/rcar_du_kms.c | 8 |
1 files 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 d6b71a9361ca..92dfa3d4c011 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); |