[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6536ebe0-4577-41dd-b3f1-1525b9fe30b7@redhat.com>
Date: Fri, 16 Feb 2024 19:28:00 +0100
From: Danilo Krummrich <dakr@...hat.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Lyude Paul <lyude@...hat.com>, David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>, Dave Airlie <airlied@...hat.com>,
dri-devel@...ts.freedesktop.org, nouveau@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Karol Herbst <kherbst@...hat.com>
Subject: Re: [PATCH] drm/nouveau/mmu/r535: uninitialized variable in
r535_bar_new_()
On 2/13/24 19:09, Dan Carpenter wrote:
> 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@...aro.org>
Applied to drm-misc-fixes, thanks!
> ---
> It looks like this was intended to handle a failure from the "rm" func
> but "rm" can't actually fail so it's easier to write the error handling
> for the code as-is.
>
> drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c
> index 4135690326f4..3a30bea30e36 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/r535.c
> @@ -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)
Powered by blists - more mailing lists