Skip to contentSkip to conversation

drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR()

PATCH Applied Dan Carpenter 2 participants 2 messages Nov 24, 2016 – Nov 25, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/hisilicon/hibmc: Checking for NULL instead of IS_ERR()

The drm_dev_alloc() function returns error pointers. It never returns NULLs.

Fixes 5e0df3a08f3d ("drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver")
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +2 -2
index 73ba8b0..d94e349 100644
@@ -377,9 +377,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
 	int ret;
 
 	dev = drm_dev_alloc(&hibmc_driver, &pdev->dev);
-	if (!dev) {
+	if (IS_ERR(dev)) {
 		DRM_ERROR("failed to allocate drm_device\n");
-		return -ENOMEM;
+		return PTR_ERR(dev);
 	}
 
 	dev->pdev = pdev;
#1 lore raw
Quoted 5 lines · Dan Carpenter

The drm_dev_alloc() function returns error pointers. It never returns NULLs.

Fixes 5e0df3a08f3d ("drm/hisilicon/hibmc: Add hisilicon hibmc drm master driver")

Applied to drm-misc, thanks.
-Daniel

Quoted 21 lines
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +2 -2
index 73ba8b0..d94e349 100644
@@ -377,9 +377,9 @@ static int hibmc_pci_probe(struct pci_dev *pdev,
 	int ret;
 
 	dev = drm_dev_alloc(&hibmc_driver, &pdev->dev);
-	if (!dev) {
+	if (IS_ERR(dev)) {
 		DRM_ERROR("failed to allocate drm_device\n");
-		return -ENOMEM;
+		return PTR_ERR(dev);
 	}
 
 	dev->pdev = pdev;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch