drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Replace kfree() with kvfree() for memory allocated by kvmalloc().
Compile-tested only.
Cc: stable@vger.kernel.org
Fixes: 8a8b1ec5261f ("drm/nouveau/gsp: split rpc handling out on its own")
Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
Reviewed-by: Timur Tabi <ttabi@nvidia.com>
Acked-by: Zhi Wang <zhiw@nvidia.com>
---
v2: Add a Fixes: tag.
---
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c
index 9d06ff722fea..0dc4782df8c0 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c
@@ -325,7 +325,7 @@ r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 gsp_rpc_len, int *retries)
rpc = r535_gsp_msgq_peek(gsp, sizeof(*rpc), info.retries);
if (IS_ERR_OR_NULL(rpc)) {
- kfree(buf);
+ kvfree(buf);
return rpc;
}
@@ -334,7 +334,7 @@ r535_gsp_msgq_recv(struct nvkm_gsp *gsp, u32 gsp_rpc_len, int *retries)
rpc = r535_gsp_msgq_recv_one_elem(gsp, &info);
if (IS_ERR_OR_NULL(rpc)) {
- kfree(buf);
+ kvfree(buf);
return rpc;
}
--
2.34.1
On 8/13/25 2:54 PM, Qianfeng Rong wrote: > Replace kfree() with kvfree() for memory allocated by kvmalloc(). > > Compile-tested only. > > Cc: stable@vger.kernel.org > Fixes: 8a8b1ec5261f ("drm/nouveau/gsp: split rpc handling out on its own") > Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com> > Reviewed-by: Timur Tabi <ttabi@nvidia.com> > Acked-by: Zhi Wang <zhiw@nvidia.com> Applied to drm-misc-fixes, thanks!
> Replace kfree() with kvfree() for memory allocated by kvmalloc(). * Would you like to improve the exception handling by using another goto chain? * How do you think about to increase the application of scope-based resource management? https://elixir.bootlin.com/linux/v6.16/source/include/linux/slab.h#L1081 Is there a need to adjust also the following statement combination? https://elixir.bootlin.com/linux/v6.16/source/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c#L312-L314 … kvfree(info.gsp_rpc_buf); info.gsp_rpc_buf = NULL; return buf; … Regards, Markus
© 2016 - 2025 Red Hat, Inc.