aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvif
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-12 08:56:09 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-08-14 17:58:39 -0400
commitef07ceae02271ac6eadc9f5cd652bb7162455a1b (patch)
treef4bd1b596e4bf62ae951ce7770fb1a3bc9ca571b /drivers/gpu/drm/nouveau/nvif
parent147ed897e807e1a6e2c6fd9dc91830f1d2831d43 (diff)
drm/nouveau/nvif: return null pointers on failure, in addition to ret != 0
Reported by Coverity. The intention is that the return value is checked, but let's be more paranoid and make it extremely obvious if something forgets to. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvif')
-rw-r--r--drivers/gpu/drm/nouveau/nvif/notify.c4
-rw-r--r--drivers/gpu/drm/nouveau/nvif/object.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nvif/notify.c b/drivers/gpu/drm/nouveau/nvif/notify.c
index 7e03cdd17827..0898c3155292 100644
--- a/drivers/gpu/drm/nouveau/nvif/notify.c
+++ b/drivers/gpu/drm/nouveau/nvif/notify.c
@@ -237,8 +237,10 @@ nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *),
237 if (notify) { 237 if (notify) {
238 int ret = nvif_notify_init(object, nvif_notify_del, func, work, 238 int ret = nvif_notify_init(object, nvif_notify_del, func, work,
239 type, data, size, reply, notify); 239 type, data, size, reply, notify);
240 if (ret) 240 if (ret) {
241 kfree(notify); 241 kfree(notify);
242 notify = NULL;
243 }
242 *pnotify = notify; 244 *pnotify = notify;
243 return ret; 245 return ret;
244 } 246 }
diff --git a/drivers/gpu/drm/nouveau/nvif/object.c b/drivers/gpu/drm/nouveau/nvif/object.c
index b0c82206ece2..dd85b56f6aa5 100644
--- a/drivers/gpu/drm/nouveau/nvif/object.c
+++ b/drivers/gpu/drm/nouveau/nvif/object.c
@@ -275,8 +275,10 @@ nvif_object_new(struct nvif_object *parent, u32 handle, u32 oclass,
275 if (object) { 275 if (object) {
276 int ret = nvif_object_init(parent, nvif_object_del, handle, 276 int ret = nvif_object_init(parent, nvif_object_del, handle,
277 oclass, data, size, object); 277 oclass, data, size, object);
278 if (ret) 278 if (ret) {
279 kfree(object); 279 kfree(object);
280 object = NULL;
281 }
280 *pobject = object; 282 *pobject = object;
281 return ret; 283 return ret;
282 } 284 }