Commit ef07ceae authored by Ben Skeggs's avatar Ben Skeggs

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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 147ed897
...@@ -237,8 +237,10 @@ nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *), ...@@ -237,8 +237,10 @@ nvif_notify_new(struct nvif_object *object, int (*func)(struct nvif_notify *),
if (notify) { if (notify) {
int ret = nvif_notify_init(object, nvif_notify_del, func, work, int ret = nvif_notify_init(object, nvif_notify_del, func, work,
type, data, size, reply, notify); type, data, size, reply, notify);
if (ret) if (ret) {
kfree(notify); kfree(notify);
notify = NULL;
}
*pnotify = notify; *pnotify = notify;
return ret; return ret;
} }
......
...@@ -275,8 +275,10 @@ nvif_object_new(struct nvif_object *parent, u32 handle, u32 oclass, ...@@ -275,8 +275,10 @@ nvif_object_new(struct nvif_object *parent, u32 handle, u32 oclass,
if (object) { if (object) {
int ret = nvif_object_init(parent, nvif_object_del, handle, int ret = nvif_object_init(parent, nvif_object_del, handle,
oclass, data, size, object); oclass, data, size, object);
if (ret) if (ret) {
kfree(object); kfree(object);
object = NULL;
}
*pobject = object; *pobject = object;
return ret; return ret;
} }
......
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