devm_drm_dev_alloc() returns an ERR_PTR() on failure. Use PTR_ERR() rather
than always returning -ENOMEM so the probe path propagates the real error
code such as -ENOMEM, -EINVAL, and -ENODEV.
Fixes: 5a5e9c0228e6 ("accel: Add Arm Ethos-U NPU driver")
Signed-off-by: Alok Tiwari <[email protected]>
---
drivers/accel/ethosu/ethosu_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/accel/ethosu/ethosu_drv.c
b/drivers/accel/ethosu/ethosu_drv.c
index 9992193d7338..196871ec2a06 100644
--- a/drivers/accel/ethosu/ethosu_drv.c
+++ b/drivers/accel/ethosu/ethosu_drv.c
@@ -337,7 +337,8 @@ static int ethosu_probe(struct platform_device *pdev)
ethosudev = devm_drm_dev_alloc(&pdev->dev, ðosu_drm_driver,
struct ethosu_device, base);
if (IS_ERR(ethosudev))
- return -ENOMEM;
+ return PTR_ERR(ethosudev);
+
platform_set_drvdata(pdev, ethosudev);
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40));
--
2.50.1