diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-08-12 22:56:09 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2014-08-15 07:58:39 +1000 |
commit | ef07ceae02271ac6eadc9f5cd652bb7162455a1b (patch) | |
tree | f4bd1b596e4bf62ae951ce7770fb1a3bc9ca571b /drivers/gpu/drm/nouveau/nvif/object.c | |
parent | 147ed897e807e1a6e2c6fd9dc91830f1d2831d43 (diff) | |
download | linux-ef07ceae02271ac6eadc9f5cd652bb7162455a1b.tar.gz linux-ef07ceae02271ac6eadc9f5cd652bb7162455a1b.tar.bz2 linux-ef07ceae02271ac6eadc9f5cd652bb7162455a1b.zip |
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/object.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/object.c | 4 |
1 files changed, 3 insertions, 1 deletions
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, 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; } |