[PATCH 1/1] drm/mga: Fix error return code in mga_do_pci_dma_bootstrap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The user may incorrectly set the value of dma_bs->secondary_bin_count to 0.
In this case, the for loop is not entered and the 'err' value remains 0.

Fixes: 6795c985a648 ("Add support for PCI MGA cards to MGA DRM.")
Reported-by: Hulk Robot <hulkci@xxxxxxxxxx>
Signed-off-by: Zhen Lei <thunder.leizhen@xxxxxxxxxx>
---
 drivers/gpu/drm/mga/mga_dma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mga/mga_dma.c b/drivers/gpu/drm/mga/mga_dma.c
index 1cb7d120d18f..e41d44ec26de 100644
--- a/drivers/gpu/drm/mga/mga_dma.c
+++ b/drivers/gpu/drm/mga/mga_dma.c
@@ -693,7 +693,7 @@ static int mga_do_pci_dma_bootstrap(struct drm_device *dev,
 	}
 
 	if (bin_count == 0) {
-		DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err);
+		DRM_ERROR("Unable to add secondary DMA buffers: %d\n", err ? : -EINVAL);
 		return err;
 	}
 
-- 
2.25.1





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux