* [PATCH] drm/nouveau/mmu/r535: uninitialized variable in r535_bar_new_()
@ 2024-02-13 18:09 Dan Carpenter
2024-02-16 18:28 ` Danilo Krummrich
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2024-02-13 18:09 UTC (permalink / raw)
To: Karol Herbst
Cc: Lyude Paul, Danilo Krummrich, David Airlie, Daniel Vetter,
Dave Airlie, Dan Carpenter, dri-devel, nouveau, linux-kernel,
kernel-janitors
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>
---
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)
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] drm/nouveau/mmu/r535: uninitialized variable in r535_bar_new_()
2024-02-13 18:09 [PATCH] drm/nouveau/mmu/r535: uninitialized variable in r535_bar_new_() Dan Carpenter
@ 2024-02-16 18:28 ` Danilo Krummrich
0 siblings, 0 replies; 2+ messages in thread
From: Danilo Krummrich @ 2024-02-16 18:28 UTC (permalink / raw)
To: Dan Carpenter
Cc: Lyude Paul, David Airlie, Daniel Vetter, Dave Airlie, dri-devel,
nouveau, linux-kernel, kernel-janitors, Karol Herbst
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@linaro.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)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-16 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 18:09 [PATCH] drm/nouveau/mmu/r535: uninitialized variable in r535_bar_new_() Dan Carpenter
2024-02-16 18:28 ` Danilo Krummrich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®