lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <CAPgLHd_dXXj061Gv85eEO-XKBVJf7d0+1VSHQZaz73o+Ne_Txw@mail.gmail.com>
Date:	Fri, 17 May 2013 17:03:52 +0800
From:	Wei Yongjun <weiyj.lk@...il.com>
To:	inki.dae@...sung.com, jy0922.shim@...sung.com,
	sw0312.kim@...sung.com, kyungmin.park@...sung.com, airlied@...ux.ie
Cc:	yongjun_wei@...ndmicro.com.cn, dri-devel@...ts.freedesktop.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH v2] drm/exynos: fix error return code exynos_drm_load()

From: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.
Change function exynos_plane_init() to return ERR_PTR(), so
the caller can use the error code from it.

Signed-off-by: Wei Yongjun <yongjun_wei@...ndmicro.com.cn>
---
v1 -> v2: change exynos_plane_init() to return ERR_PTR().
---
 drivers/gpu/drm/exynos/exynos_drm_plane.c | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_crtc.c  | 4 ++--
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 4 +++-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c
index 83efc66..2770f4b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_plane.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c
@@ -282,7 +282,7 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev,
 	exynos_plane = kzalloc(sizeof(struct exynos_plane), GFP_KERNEL);
 	if (!exynos_plane) {
 		DRM_ERROR("failed to allocate plane\n");
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 
 	err = drm_plane_init(dev, &exynos_plane->base, possible_crtcs,
@@ -291,7 +291,7 @@ struct drm_plane *exynos_plane_init(struct drm_device *dev,
 	if (err) {
 		DRM_ERROR("failed to initialize plane\n");
 		kfree(exynos_plane);
-		return NULL;
+		return ERR_PTR(err);
 	}
 
 	if (priv)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
index e8894bc..21d0675 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c
@@ -345,9 +345,9 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
 	exynos_crtc->pipe = nr;
 	exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
 	exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true);
-	if (!exynos_crtc->plane) {
+	if (IS_ERR(exynos_crtc->plane)) {
 		kfree(exynos_crtc);
-		return -ENOMEM;
+		return PTR_ERR(exynos_crtc->plane);
 	}
 
 	crtc = &exynos_crtc->drm_crtc;

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index ba6d995..44f1d50 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -91,8 +91,10 @@ static int exynos_drm_load(struct drm_device *dev, unsigned long flags)
 		unsigned int possible_crtcs = (1 << MAX_CRTC) - 1;
 
 		plane = exynos_plane_init(dev, possible_crtcs, false);
-		if (!plane)
+		if (IS_ERR(plane) {
+			ret = PTR_ERR(plane);
 			goto err_release_iommu_mapping;
+		}
 	}
 
 	ret = drm_vblank_init(dev, MAX_CRTC);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ