summaryrefslogtreecommitdiff
path: root/nvif
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-12 22:56:09 +1000
committerBen Skeggs <bskeggs@redhat.com>2014-08-15 07:56:26 +1000
commitf7102e838dfba8cbc3efb750be027ea6891414e7 (patch)
treef66b7a3c7641308e6b89f508897f796338c74069 /nvif
parent51211baaf4f2aba1ba8821cb69d9fce07d01a872 (diff)
downloadnouveau-f7102e838dfba8cbc3efb750be027ea6891414e7.tar.gz
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 'nvif')
-rw-r--r--nvif/notify.c4
-rw-r--r--nvif/object.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/nvif/notify.c b/nvif/notify.c
index 7e03cdd17..0898c3155 100644
--- a/nvif/notify.c
+++ b/nvif/notify.c
@@ -237,8 +237,10 @@ nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *),
if (notify) {
int ret = nvif_notify_init(object, nvif_notify_del, func, work,
type, data, size, reply, notify);
- if (ret)
+ if (ret) {
kfree(notify);
+ notify = NULL;
+ }
*pnotify = notify;
return ret;
}
diff --git a/nvif/object.c b/nvif/object.c
index b0c82206e..dd85b56f6 100644
--- a/nvif/object.c
+++ b/nvif/object.c
@@ -275,8 +275,10 @@ nvif_object_new(struct nvif_object *parent, u32 handle, u32 oclass,
if (object) {
int ret = nvif_object_init(parent, nvif_object_del, handle,
oclass, data, size, object);
- if (ret)
+ if (ret) {
kfree(object);
+ object = NULL;
+ }
*pobject = object;
return ret;
}