vgem: fix error return in vgem_init()
Subsystems (2)
PATCH v2 1/1 vgem: fix error return in vgem_init()
From: Alexandr Sapozhnikov <[email protected]>
The dma_coerce_mask_and_coherent function may
fail to apply a mask due to incorrectly passed parameters. However, since this function returns the -EIO error, this is an abnormal situation and the error should be logged.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/gpu/drm/vgem/vgem_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/vgem/vgem_drv.c +3 -1
@@ -140,8 +140,10 @@ static int __init vgem_init(void) goto out_unregister; } -dma_coerce_mask_and_coherent (&pdev->dev, + ret =dma_coerce_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (ret) + goto out_unregister; vgem_device =devm_drm_dev_alloc (&pdev->dev, &vgem_driver, struct vgem_device, drm);
Signature · 1 line
2.43.0
Quoted 2 lines
The
dma_coerce_mask_and_coherentfunction may fail to apply a mask due to incorrectly passed parameters.
…
* You may occasionally put more than 61 characters into text lines of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17#n658
* Would you like to choose another imperative wording?
* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
…
Quoted 2 lines
--- drivers/gpu/drm/vgem/vgem_drv.c | 4 +++-
…
Some contributors would appreciate patch version descriptions.
https://lore.kernel.org/all/?q=%22This+looks+like+a+new+version+of+a+previously+submitted+patch%22
…
drivers/gpu/drm/vgem/vgem_drv.c static int __init vgem_init(void) · line 146
Quoted 10 lines
+++
b/drivers/gpu/drm/vgem/vgem_drv.cdrivers/gpu/drm/vgem/vgem_drv.c +3
-1@@ -140,8 +140,10 @@ static int __init vgem_init(void) goto out_unregister; } -dma_coerce_mask_and_coherent (&pdev->dev, + ret =dma_coerce_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (64 )); +if (ret) + goto out_unregister;
…
I suggest to keep the passed parameters in the same line for this function call.
Regards,
Markus