gpu: drm: Use dev_err_probe instead of dev_err
Subsystems (4)
PATCH v2 1/1 gpu: drm: Use dev_err_probe instead of dev_err
It is possible that dma_request_chan will return EPROBE_DEFER, which means that disp->dev is not ready yet. In this case, dev_err(disp->dev), there will be no output. This patch fixes the bug.
--- drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/xlnx/zynqmp_disp.c +2 -2
@@ -1094,8 +1094,8 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, "%s%u", dma_names[layer->id], i); dma->chan =dma_request_chan (disp->dev, dma_channel_name);if (IS_ERR (dma->chan)) { -dev_err (disp->dev,"failed to request dma channel\n" ); - ret =PTR_ERR (dma->chan); + ret =dev_err_probe (disp->dev,PTR_ERR (dma->chan), +"failed to request dma channel\n" ); dma->chan =NULL ;return ret; }
Signature · 1 line
2.25.1
Hi Wang,
Thank you for the patch.
Quoted 3 lines · Wang Ming
It is possible that
dma_request_chanwill returnEPROBE_DEFER, which means thatdisp->devis not ready yet. In this case,dev_err(disp->dev), there will be no output. This patch fixes the bug.
It's not a bug. The existing code works as expected. dev_err_probe() is nicer though, as it records the reason for the probe deferral. Here's a proposal for a better commit message:
It is possible that dma_request_chan() returns EPROBE_DEFER, in which case the driver defers probing without printing any message. Use dev_err_probe() to record the probe deferral cause and ease debugging.
Quoted 10 lines
Signed-off-by Wang Ming <[email protected]>--- drivers/gpu/drm/xlnx/zynqmp_disp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/xlnx/zynqmp_disp.c +0
-0
drivers/gpu/drm/xlnx/zynqmp_disp.c static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, · line 1098
Quoted 7 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +2
-2@@ -1094,8 +1094,8 @@ static int zynqmp_disp_layer_request_dma(struct zynqmp_disp *disp, "%s%u", dma_names[layer->id], i); dma->chan =dma_request_chan (disp->dev, dma_channel_name);if (IS_ERR (dma->chan)) { -dev_err (disp->dev,"failed to request dma channel\n" ); - ret =PTR_ERR (dma->chan); + ret =dev_err_probe (disp->dev,PTR_ERR (dma->chan), +"failed to request dma channel\n" );
The alignment is wrong, this should be
ret = dev_err_probe(disp->dev, PTR_ERR(dma->chan), "failed to request dma channel\n");
If you're fine with those changes, I can fix this locally, there's no need to resubmit.
Quoted 3 lines
drivers/gpu/drm/xlnx/zynqmp_disp.c +0
-0dma->chan =NULL ;return ret; }
Signature · 3 lines
Regards, Laurent Pinchart