Skip to contentSkip to conversation

drm/imx: drm_dev_alloc() returns error pointers

PATCH Applied Dan Carpenter 3 participants 3 messages Oct 13, 2016 – Oct 17, 2016

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

PATCH 1/1 drm/imx: drm_dev_alloc() returns error pointers

We are checking for NULL here, when we should be checking for error pointers.

Fixes 54db5decce17 ("drm/imx: drop deprecated load/unload drm_driver ops")
drivers/gpu/drm/imx/imx-drm-core.c +2 -2
index 98df09c..3acc976 100644
@@ -357,8 +357,8 @@ static int imx_drm_bind(struct device *dev)
 	int ret;
 
 	drm = drm_dev_alloc(&imx_drm_driver, dev);
-	if (!drm)
-		return -ENOMEM;
+	if (IS_ERR(drm))
+		return PTR_ERR(drm);
 
 	imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL);
 	if (!imxdrm) {
Reviewed-by on v1 1/1
#1 lore raw

Am Donnerstag, den 13.10.2016, 11:53 +0300 schrieb Dan Carpenter:

Quoted 6 lines

We are checking for NULL here, when we should be checking for error pointers.

Fixes 54db5decce17 ("drm/imx: drop deprecated load/unload drm_driver

ops")

Quoted 17 lines
drivers/gpu/drm/imx/imx-drm-core.c +0 -0
index 98df09c..3acc976 100644
@@ -357,8 +357,8 @@ static int imx_drm_bind(struct device *dev)
  	int ret;


  drm = drm_dev_alloc(&imx_drm_driver, dev);

drivers/gpu/drm/imx/imx-drm-core.c +2 -2
-	if (!drm)
-		return -ENOMEM;
+	if (IS_ERR(drm))
+		return PTR_ERR(drm);


  imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL); if (!imxdrm) {

#2 lore raw
In reply to Dan Carpenter

Am Donnerstag, den 13.10.2016, 11:53 +0300 schrieb Dan Carpenter:

Quoted 11 lines

We are checking for NULL here, when we should be checking for error pointers.

Fixes 54db5decce17 ("drm/imx: drop deprecated load/unload drm_driver ops")
drivers/gpu/drm/imx/imx-drm-core.c +0 -0
index 98df09c..3acc976 100644

drivers/gpu/drm/imx/imx-drm-core.c static int imx_drm_bind(struct device *dev) · line 364

Quoted 10 lines
drivers/gpu/drm/imx/imx-drm-core.c +2 -2
@@ -357,8 +357,8 @@ static int imx_drm_bind(struct device *dev)
 	int ret;
 
 	drm = drm_dev_alloc(&imx_drm_driver, dev);
-	if (!drm)
-		return -ENOMEM;
+	if (IS_ERR(drm))
+		return PTR_ERR(drm);
 
 	imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL);
 	if (!imxdrm) {

Applied, thanks.

regards
Philipp