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


Groups > linux.kernel > #1371136

[PATCH 2/2] gma500: Add new error checking for the function, psb_driver_load

From Bastien Philbert <bastienphilbert@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 2/2] gma500: Add new error checking for the function, psb_driver_load
Date 2016-04-05 04:40 +0200
Message-ID <rkp4l-4qU-1@gated-at.bofh.it> (permalink)
References <rkp4l-4qU-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This adds new error checking to the function, psb_driver_load
for when the function, psb_mmu_inset_pfn_sequence fails to grab
memory for the internal function call to psb_pd_addr_end. In
addition we now implement this by checking for a error code
return  value from the internal call to the function,
psb_mmu_inset_pfn_sequence for the function, psb_driver_load.
If a error code is returned we must jump to a new label,
unlock_err in order to deallocate our usage count by
one for the usage of the semaphore, sem before unloading

Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
---
 drivers/gpu/drm/gma500/psb_drv.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index 4e1c685..52651fb 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -343,7 +343,10 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 					  dev_priv->stolen_base >> PAGE_SHIFT,
 					  pg->gatt_start,
 					  pg->stolen_size >> PAGE_SHIFT, 0);
+	if (ret)
+		goto unlock_err;
 	up_read(&pg->sem);
+
 
 	psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv->mmu), 0);
 	psb_mmu_set_pd_context(dev_priv->pf_pd, 1);
@@ -405,6 +408,8 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
 #endif
 	/* Intel drm driver load is done, continue doing pvr load */
 	return 0;
+unlock_err:
+	up_read(&pg->sem);
 out_err:
 	psb_driver_unload(dev);
 	return ret;
-- 
2.5.0

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


Thread

[PATCH 2/2] gma500: Add new error checking for the function, psb_driver_load Bastien Philbert <bastienphilbert@gmail.com> - 2016-04-05 04:40 +0200

csiph-web