Commit 7e9ab408 authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-coverity-fixes' of git://people.freedesktop.org/~danvet/drm into drm-next

bunch of coverity fixes all minor.

* 'drm-coverity-fixes' of git://people.freedesktop.org/~danvet/drm:
  drm: Fix error handling in drm_master_create
  drm/i2c/tda998x: Fix signed overflow issue
  drm/bochs: Remove unecessary NULL check in gem_free
  drm/bochs: Remove unnecessary NULL check in bo_unref
  drm/udl: Initialize ret in udl_driver_load
  drm/via: Remove unecessary NULL check
  drm/ast: Remove unecessary NULL check in gem_free
  drm/ast: Remove unnecessary NULL check in bo_unref
  drm/cirrus: Remove unecessary NULL check in gem_free
  drm/cirrus: Remove unnecessary NULL check in bo_unref
  drm/mgag200: Remove unecessary NULL check in gem_free
  drm/mgag200: Remove unecessary NULL check in bo_unref
parents 2c9b25c5 10e68569
...@@ -411,16 +411,13 @@ static void ast_bo_unref(struct ast_bo **bo) ...@@ -411,16 +411,13 @@ static void ast_bo_unref(struct ast_bo **bo)
tbo = &((*bo)->bo); tbo = &((*bo)->bo);
ttm_bo_unref(&tbo); ttm_bo_unref(&tbo);
if (tbo == NULL) *bo = NULL;
*bo = NULL;
} }
void ast_gem_free_object(struct drm_gem_object *obj) void ast_gem_free_object(struct drm_gem_object *obj)
{ {
struct ast_bo *ast_bo = gem_to_ast_bo(obj); struct ast_bo *ast_bo = gem_to_ast_bo(obj);
if (!ast_bo)
return;
ast_bo_unref(&ast_bo); ast_bo_unref(&ast_bo);
} }
......
...@@ -434,17 +434,13 @@ static void bochs_bo_unref(struct bochs_bo **bo) ...@@ -434,17 +434,13 @@ static void bochs_bo_unref(struct bochs_bo **bo)
tbo = &((*bo)->bo); tbo = &((*bo)->bo);
ttm_bo_unref(&tbo); ttm_bo_unref(&tbo);
if (tbo == NULL) *bo = NULL;
*bo = NULL;
} }
void bochs_gem_free_object(struct drm_gem_object *obj) void bochs_gem_free_object(struct drm_gem_object *obj)
{ {
struct bochs_bo *bochs_bo = gem_to_bochs_bo(obj); struct bochs_bo *bochs_bo = gem_to_bochs_bo(obj);
if (!bochs_bo)
return;
bochs_bo_unref(&bochs_bo); bochs_bo_unref(&bochs_bo);
} }
......
...@@ -264,17 +264,13 @@ static void cirrus_bo_unref(struct cirrus_bo **bo) ...@@ -264,17 +264,13 @@ static void cirrus_bo_unref(struct cirrus_bo **bo)
tbo = &((*bo)->bo); tbo = &((*bo)->bo);
ttm_bo_unref(&tbo); ttm_bo_unref(&tbo);
if (tbo == NULL) *bo = NULL;
*bo = NULL;
} }
void cirrus_gem_free_object(struct drm_gem_object *obj) void cirrus_gem_free_object(struct drm_gem_object *obj)
{ {
struct cirrus_bo *cirrus_bo = gem_to_cirrus_bo(obj); struct cirrus_bo *cirrus_bo = gem_to_cirrus_bo(obj);
if (!cirrus_bo)
return;
cirrus_bo_unref(&cirrus_bo); cirrus_bo_unref(&cirrus_bo);
} }
......
...@@ -128,7 +128,10 @@ struct drm_master *drm_master_create(struct drm_minor *minor) ...@@ -128,7 +128,10 @@ struct drm_master *drm_master_create(struct drm_minor *minor)
kref_init(&master->refcount); kref_init(&master->refcount);
spin_lock_init(&master->lock.spinlock); spin_lock_init(&master->lock.spinlock);
init_waitqueue_head(&master->lock.lock_queue); init_waitqueue_head(&master->lock.lock_queue);
drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER); if (drm_ht_create(&master->magiclist, DRM_MAGIC_HASH_ORDER)) {
kfree(master);
return NULL;
}
INIT_LIST_HEAD(&master->magicfree); INIT_LIST_HEAD(&master->magicfree);
master->minor = minor; master->minor = minor;
......
...@@ -568,11 +568,11 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data) ...@@ -568,11 +568,11 @@ static irqreturn_t tda998x_irq_thread(int irq, void *data)
static uint8_t tda998x_cksum(uint8_t *buf, size_t bytes) static uint8_t tda998x_cksum(uint8_t *buf, size_t bytes)
{ {
uint8_t sum = 0; int sum = 0;
while (bytes--) while (bytes--)
sum += *buf++; sum -= *buf++;
return (255 - sum) + 1; return sum;
} }
#define HB(x) (x) #define HB(x) (x)
......
...@@ -322,17 +322,13 @@ static void mgag200_bo_unref(struct mgag200_bo **bo) ...@@ -322,17 +322,13 @@ static void mgag200_bo_unref(struct mgag200_bo **bo)
tbo = &((*bo)->bo); tbo = &((*bo)->bo);
ttm_bo_unref(&tbo); ttm_bo_unref(&tbo);
if (tbo == NULL) *bo = NULL;
*bo = NULL;
} }
void mgag200_gem_free_object(struct drm_gem_object *obj) void mgag200_gem_free_object(struct drm_gem_object *obj)
{ {
struct mgag200_bo *mgag200_bo = gem_to_mga_bo(obj); struct mgag200_bo *mgag200_bo = gem_to_mga_bo(obj);
if (!mgag200_bo)
return;
mgag200_bo_unref(&mgag200_bo); mgag200_bo_unref(&mgag200_bo);
} }
......
...@@ -294,6 +294,7 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -294,6 +294,7 @@ int udl_driver_load(struct drm_device *dev, unsigned long flags)
dev->dev_private = udl; dev->dev_private = udl;
if (!udl_parse_vendor_descriptor(dev, dev->usbdev)) { if (!udl_parse_vendor_descriptor(dev, dev->usbdev)) {
ret = -ENODEV;
DRM_ERROR("firmware not recognized. Assume incompatible device\n"); DRM_ERROR("firmware not recognized. Assume incompatible device\n");
goto err; goto err;
} }
......
...@@ -79,7 +79,7 @@ int via_final_context(struct drm_device *dev, int context) ...@@ -79,7 +79,7 @@ int via_final_context(struct drm_device *dev, int context)
/* Linux specific until context tracking code gets ported to BSD */ /* Linux specific until context tracking code gets ported to BSD */
/* Last context, perform cleanup */ /* Last context, perform cleanup */
if (list_is_singular(&dev->ctxlist) && dev->dev_private) { if (list_is_singular(&dev->ctxlist)) {
DRM_DEBUG("Last Context\n"); DRM_DEBUG("Last Context\n");
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
via_cleanup_futex(dev_priv); via_cleanup_futex(dev_priv);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment