Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1512763

[PATCH] drm/imx: Fix error handling

From Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Newsgroups linux.kernel
Subject [PATCH] drm/imx: Fix error handling
Date 2016-10-31 19:10 +0100
Message-ID <sypbX-5T4-19@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


'drm_dev_alloc()' returns an error pointer in case of error, not NULL
So test it with IS_ERR.

This behavior has been introduced recently in	0f2886057be3. For some
reason, this file has not been updated.

Fixes: 0f2886057be3 ("drm: Don't swallow error codes in drm_dev_alloc()")

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/gpu/drm/imx/imx-drm-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 98df09c2b388..3acc976cc04e 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -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) {
-- 
2.9.3

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] drm/imx: Fix error handling Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2016-10-31 19:10 +0100
  Re: [PATCH] drm/imx: Fix error handling Philipp Zabel <p.zabel@pengutronix.de> - 2016-11-01 10:10 +0100

csiph-web