]> git.itanic.dy.fi Git - linux-stable/commitdiff
drm/nouveau/mmu/r535: uninitialized variable in r535_bar_new_()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 13 Feb 2024 18:09:57 +0000 (21:09 +0300)
committerDanilo Krummrich <dakr@redhat.com>
Fri, 16 Feb 2024 17:58:31 +0000 (18:58 +0100)
If gf100_bar_new_() fails then "bar" is not initialized.

Fixes: 5bf0257136a2 ("drm/nouveau/mmu/r535: initial support")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/dab21df7-4d90-4479-97d8-97e5d228c714@moroto.mountain
drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c

index 4135690326f44789535e8cb375ccfe1ee5fa68c3..3a30bea30e366f47ecda0bbabac5441aed285565 100644 (file)
@@ -168,12 +168,11 @@ r535_bar_new_(const struct nvkm_bar_func *hw, struct nvkm_device *device,
        rm->flush = r535_bar_flush;
 
        ret = gf100_bar_new_(rm, device, type, inst, &bar);
-       *pbar = bar;
        if (ret) {
-               if (!bar)
-                       kfree(rm);
+               kfree(rm);
                return ret;
        }
+       *pbar = bar;
 
        bar->flushBAR2PhysMode = ioremap(device->func->resource_addr(device, 3), PAGE_SIZE);
        if (!bar->flushBAR2PhysMode)