diff options
author | Paul Geary <paul.geary@arm.com> | 2013-04-11 12:37:32 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@mpd-gerrit-dev.cambridge.arm.com> | 2013-04-11 12:37:32 +0100 |
commit | 8fb108885ec6943cb79fd8cbe800a3825ab6bdb5 (patch) | |
tree | a2dd6f761751ee28e193dca88653f2cebe228862 | |
parent | 34579dc86d0546aed6c145b5e9f1e611541d5b5e (diff) | |
parent | 6fe52f3a92bf830dccbefecbb4616d186068d3ae (diff) |
Merge "Fixes miscellaneous static analysis warnings"
-rw-r--r-- | src/drmmode_display.c | 23 | ||||
-rw-r--r-- | src/omap_dri2.c | 6 | ||||
-rw-r--r-- | src/omap_drmif_fb.h | 1 | ||||
-rw-r--r-- | src/omap_exa.c | 9 | ||||
-rw-r--r-- | src/omap_exa_null.c | 7 |
5 files changed, 37 insertions, 9 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c index e847972..e41097e 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -64,10 +64,8 @@ #include "scrnintstr.h" #include "fb.h" #include "xf86cmap.h" -#include "shadowfb.h" #include "xf86xv.h" -#include <X11/extensions/Xv.h> #include "xf86Cursor.h" #include "xf86DDC.h" @@ -91,7 +89,6 @@ #include "drm_fourcc.h" #include "X11/Xatom.h" -#include <sys/ioctl.h> #include <libudev.h> #include "drmmode_driver.h" @@ -248,6 +245,8 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, return FALSE; fb_id = omap_bo_get_fb(pOMAP->scanout); + if (0 == fb_id) + return FALSE; } /* Save the current mode in case there's a problem: */ @@ -439,6 +438,13 @@ drmmode_load_cursor_argb(xf86CrtcPtr crtc, CARD32 *image) drmmode_hide_cursor(crtc); d = omap_bo_map(cursor->bo); + if(!d) { + xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, + "load_cursor_argb map failure\n"); + if (visible) + drmmode_show_cursor(crtc); + return; + } #if ( DRM_CURSOR_PLANE_FORMAT == HW_CURSOR_ARGB ) memcpy(d, image, omap_bo_size(cursor->bo)); @@ -1075,7 +1081,7 @@ drmmode_xf86crtc_resize(ScrnInfoPtr pScrn, int width, int height) { OMAPPtr pOMAP = OMAPPTR(pScrn); ScreenPtr pScreen = pScrn->pScreen; - struct omap_bo *new_scanout; + struct omap_bo *new_scanout = NULL; int res; uint32_t pitch; int i; @@ -1178,6 +1184,10 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp) TRACE_ENTER(); drmmode = calloc(1, sizeof *drmmode); + if(!drmmode) { + return FALSE; + } + drmmode->fd = fd; xf86CrtcConfigInit(pScrn, &drmmode_xf86crtc_config_funcs); @@ -1186,6 +1196,7 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, int fd, int cpp) drmmode->cpp = cpp; drmmode->mode_res = drmModeGetResources(drmmode->fd); if (!drmmode->mode_res) { + free(drmmode); return FALSE; } else { DEBUG_MSG("Got KMS resources"); @@ -1379,12 +1390,14 @@ static void drmmode_wakeup_handler(pointer data, int err, pointer p) { ScrnInfoPtr pScrn = data; - drmmode_ptr drmmode = drmmode_from_scrn(pScrn); + drmmode_ptr drmmode; fd_set *read_mask = p; if (pScrn == NULL || err < 0) return; + drmmode = drmmode_from_scrn(pScrn); + if (FD_ISSET(drmmode->fd, read_mask)) drmHandleEvent(drmmode->fd, &event_context); } diff --git a/src/omap_dri2.c b/src/omap_dri2.c index 4e2587c..1372b0a 100644 --- a/src/omap_dri2.c +++ b/src/omap_dri2.c @@ -33,7 +33,6 @@ #include "omap_driver.h" #include "omap_exa.h" -#include "xf86drmMode.h" #include "dri2.h" /* any point to support earlier? */ @@ -473,6 +472,11 @@ OMAPDRI2ScheduleSwap(ClientPtr client, DrawablePtr pDraw, OMAPPixmapPrivPtr src_priv, dst_priv; int new_canflip, ret; + if(!cmd) + { + return FALSE; + } + cmd->client = client; cmd->pScreen = pScreen; cmd->draw_id = pDraw->id; diff --git a/src/omap_drmif_fb.h b/src/omap_drmif_fb.h index 25bf5ad..c111f22 100644 --- a/src/omap_drmif_fb.h +++ b/src/omap_drmif_fb.h @@ -46,6 +46,7 @@ struct omap_device; enum omap_gem_op { OMAP_GEM_READ = 0x01, OMAP_GEM_WRITE = 0x02, + OMAP_GEM_READ_WRITE = 0x03, }; enum omap_buf_type { diff --git a/src/omap_exa.c b/src/omap_exa.c index 466d0c2..10c926a 100644 --- a/src/omap_exa.c +++ b/src/omap_exa.c @@ -84,8 +84,13 @@ OMAPCreatePixmap2 (ScreenPtr pScreen, int width, int height, OMAPPixmapPrivPtr priv = calloc(sizeof(OMAPPixmapPrivRec), 1); ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; OMAPPtr pOMAP = OMAPPTR(pScrn); - enum omap_buf_type buf_type = OMAP_BO_NON_SCANOUT; + + if(!priv) + { + return NULL; + } + if (usage_hint & OMAP_CREATE_PIXMAP_SCANOUT) { buf_type = OMAP_BO_SCANOUT; @@ -243,7 +248,7 @@ static inline enum omap_gem_op idx2op(int index) case EXA_PREPARE_AUX_DEST: case EXA_PREPARE_DEST: default: - return OMAP_GEM_READ | OMAP_GEM_WRITE; + return OMAP_GEM_READ_WRITE; } } diff --git a/src/omap_exa_null.c b/src/omap_exa_null.c index b821d30..a43c448 100644 --- a/src/omap_exa_null.c +++ b/src/omap_exa_null.c @@ -96,11 +96,16 @@ OMAPEXAPtr InitNullEXA(ScreenPtr pScreen, ScrnInfoPtr pScrn, int fd) { OMAPNullEXAPtr null_exa = calloc(sizeof (*null_exa), 1); - OMAPEXAPtr omap_exa = (OMAPEXAPtr)null_exa; + OMAPEXAPtr omap_exa; ExaDriverPtr exa; INFO_MSG("Soft EXA mode"); + if(!null_exa) { + return NULL; + } + omap_exa = (OMAPEXAPtr)null_exa; + exa = exaDriverAlloc(); if (!exa) { goto fail; |