[PATCH 1/2] xf86-video-intel: i830_driver: drop I830GetRec

Eric Anholt eric at anholt.net
Wed Dec 10 23:45:22 PST 2008


On Wed, 2008-11-26 at 01:39 -0500, Andres Salomon wrote:
> There are a number of minor issues w/ I830GetRec:
>  - pI830 is local, and therefore never gets used
>  - it only ever returns TRUE (no need to check the result)
>  - it's only ever called once, so there's not much point in protecting
>    against multple calls
> 
> So, this drops I830GetRec and instead just calls xnfcalloc directly.  Since
> xnfcalloc will never fail, there's no point in checking the result.

Does this result in a leak for server regen?

> Signed-off-by: Andres Salomon <dilinger at debian.org>
> ---
>  src/i830_driver.c |   16 +---------------
>  1 files changed, 1 insertions(+), 15 deletions(-)
> 
> diff --git a/src/i830_driver.c b/src/i830_driver.c
> index 1407a22..a24c8da 100644
> --- a/src/i830_driver.c
> +++ b/src/i830_driver.c
> @@ -402,17 +402,6 @@ I830AvailableOptions(int chipid, int busid)
>     return NULL;
>  }
>  
> -static Bool
> -I830GetRec(ScrnInfoPtr pScrn)
> -{
> -   I830Ptr pI830;
> -
> -   if (pScrn->driverPrivate)
> -      return TRUE;
> -   pI830 = pScrn->driverPrivate = xnfcalloc(sizeof(I830Rec), 1);
> -   return TRUE;
> -}
> -
>  static void
>  I830FreeRec(ScrnInfoPtr pScrn)
>  {
> @@ -1755,11 +1744,8 @@ I830PreInit(ScrnInfoPtr pScrn, int flags)
>     if (flags & PROBE_DETECT)
>         return TRUE;
>  
> -   /* Allocate driverPrivate */
> -   if (!I830GetRec(pScrn))
> -      return FALSE;
> +   pI830 = pScrn->driverPrivate = xnfcalloc(sizeof(I830Rec), 1);
>  
> -   pI830 = I830PTR(pScrn);
>     pI830->SaveGeneration = -1;
>     pI830->pEnt = pEnt;
>     pI830->use_drm_mode = drm_mode_setting;
-- 
Eric Anholt
eric at anholt.net                         eric.anholt at intel.com


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg/attachments/20081210/36efba81/attachment.pgp>


More information about the xorg mailing list