Greetings Greg and others,
I am sending a two part patch fix to prove to Greg I have changed. 
Below this message are the patches for a bug fix in the gma500 driver
code. Unfortunately I haven't gotten a maintainer acknowledge and
therefore it's not in the merge for the 4.1 release.
Nick
Patch 1
  1 From 2d2ddb5d9a2c4fcbae45339d4f775fcde49f36e1 Mon Sep 17 00:00:00 2001
  2 From: Nicholas Krause <xerofo...@gmail.com>
  3 Date: Wed, 13 May 2015 21:36:44 -0400
  4 Subject: [PATCH 1/2] gma500:Add proper use of the variable ret for the
  5  function, psb_mmu_inset_pfn_sequence
  6 
  7 This adds proper use of the variable ret by returning it
  8 at the end of the function, psb_mmu_inset_pfn_sequence for
  9 indicating to callers when an error has occurred. Further
 10 more remove the unneeded double setting of ret to the error
 11 code, -ENOMEM after checking if a call to the function,
 12 psb_mmu_pt_alloc_map_lock is successful.
 13 
 14 Signed-off-by: Nicholas Krause <xerofo...@gmail.com>
 15 ---
 16  drivers/gpu/drm/gma500/mmu.c | 7 +++----
 17  1 file changed, 3 insertions(+), 4 deletions(-)
 18 
 19 diff --git a/drivers/gpu/drm/gma500/mmu.c b/drivers/gpu/drm/gma500/mmu.c
 20 index 0eaf11c..d2c4bac 100644
 21 --- a/drivers/gpu/drm/gma500/mmu.c
 22 +++ b/drivers/gpu/drm/gma500/mmu.c
 23 @@ -677,10 +677,9 @@ int psb_mmu_insert_pfn_sequence(struct psb_mmu_pd *pd, 
uint32_t start_pfn,
 24         do {
 25                 next = psb_pd_addr_end(addr, end);
 26                 pt = psb_mmu_pt_alloc_map_lock(pd, addr);
 27 -               if (!pt) {
 28 -                       ret = -ENOMEM;
 29 +               if (!pt)
 30                         goto out;
 31 -               }
 32 +
 33                 do {
 34                         pte = psb_mmu_mask_pte(start_pfn++, type);
 35                         psb_mmu_set_pte(pt, addr, pte);
 36 @@ -700,7 +699,7 @@ out:
 37         if (pd->hw_context != -1)
 38                 psb_mmu_flush(pd->driver);
 39 
 40 -       return 0;
 41 +       return ret;
 42  }
 43 
 44  int psb_mmu_insert_pages(struct psb_mmu_pd *pd, struct page **pages,
 45 -- 
 46 2.1.4
 47 
Patch 2
  1 From f1802ff61ef69ff9ecaaeadb941d4ed725a0255a Mon Sep 17 00:00:00 2001
  2 From: Nicholas Krause <xerofo...@gmail.com>
  3 Date: Fri, 22 May 2015 23:10:49 -0400
  4 Subject: [PATCH 2/2] gma500: Add new error checking for the function, 
psb_driver_load
  5 
  6 This adds new error checking to the function, psb_driver_load
  7 for when the function, psb_mmu_inset_pfn_sequence fails to grab
  8 memory for the internal function call to psb_pd_addr_end. In
  9 addition we now implement this by checking for a error code
 10 return  value from the internal call to the function,
 11 psb_mmu_inset_pfn_sequence for the function, psb_driver_load.
 12 If a error code is returned we must jump to a new label,
 13 unlock_err in order to deallocate our usage count by
 14 one for the usage of the semaphore, sem before unloading
 15 the drm_device structure and returning a error code.
 16 
 17 Signed-off-by: Nicholas Krause <xerofo...@gmail.com>
 18 ---
 19  drivers/gpu/drm/gma500/psb_drv.c | 4 ++++
 20  1 file changed, 4 insertions(+)
 21 
 22 diff --git a/drivers/gpu/drm/gma500/psb_drv.c 
b/drivers/gpu/drm/gma500/psb_drv.c
 23 index 92e7e57..4cef2c9 100644
 24 --- a/drivers/gpu/drm/gma500/psb_drv.c
 25 +++ b/drivers/gpu/drm/gma500/psb_drv.c
 26 @@ -343,6 +343,8 @@ static int psb_driver_load(struct drm_device *dev, 
unsigned long flags)
 27                                           dev_priv->stolen_base >> 
PAGE_SHIFT,
 28                                           pg->gatt_start,
 29                                           pg->stolen_size >> PAGE_SHIFT, 0);
 30 +       if (ret)
 31 +               goto unlock_err;
 32         up_read(&pg->sem);
 33 
 34         psb_mmu_set_pd_context(psb_mmu_get_default_pd(dev_priv->mmu), 0);
 35 @@ -405,6 +407,8 @@ static int psb_driver_load(struct drm_device *dev, 
unsigned long flags)
 36  #endif
 37         /* Intel drm driver load is done, continue doing pvr load */
 38         return 0;
 39 +unlock_err:
 40 +       up_read(&pg->sem);
 41  out_err:
 42         psb_driver_unload(dev);
 43         return ret;
 44 -- 
 45 2.1.4
 46 
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to