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

Andres Salomon dilinger at queued.net
Tue Nov 25 22:39:39 PST 2008


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.

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;
-- 
1.5.6.5




More information about the xorg mailing list