media: platform: Use dev_err_probe instead of dev_err
authorWang Ming <machel@vivo.com>
Wed, 26 Jul 2023 11:51:58 +0000 (19:51 +0800)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Wed, 27 Sep 2023 07:40:01 +0000 (09:40 +0200)
It is possible that dma_request_chan will return EPROBE_DEFER,
which means that dma->xdev->dev is not ready yet. In this case,
dev_err(dma->xdev->dev), there will be no output. This patch
fixes the bug.

Signed-off-by: Wang Ming <machel@vivo.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/xilinx/xilinx-dma.c

index 80d6f5b072ea648e029b2fad447664a067159622..a96de5d388a1deec214f9be8ba7e1507a4315519 100644 (file)
@@ -708,9 +708,8 @@ int xvip_dma_init(struct xvip_composite_device *xdev, struct xvip_dma *dma,
        snprintf(name, sizeof(name), "port%u", port);
        dma->dma = dma_request_chan(dma->xdev->dev, name);
        if (IS_ERR(dma->dma)) {
-               ret = PTR_ERR(dma->dma);
-               if (ret != -EPROBE_DEFER)
-                       dev_err(dma->xdev->dev, "no VDMA channel found\n");
+               ret = dev_err_probe(dma->xdev->dev, PTR_ERR(dma->dma),
+                                   "no VDMA channel found\n");
                goto error;
        }