* [PATCH v5 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage
@ 2026-06-22 8:11 Hongling Zeng
2026-06-29 8:36 ` Hongling Zeng
0 siblings, 1 reply; 3+ messages in thread
From: Hongling Zeng @ 2026-06-22 8:11 UTC (permalink / raw)
To: lyude, dakr, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, airlied, ttabi, bskeggs, dri-devel
Cc: nouveau, linux-kernel, zhongling0719, Hongling Zeng
This series addresses feedback from Danilo Krummrich and Timur Tabi
regarding the use of IS_ERR() vs IS_ERR_OR_NULL() in the nouveau
GSP RPC code.
The key insight is that we should align error checking with the actual
return value contracts of each function:
- Functions that never return NULL should use IS_ERR()
- Functions that can return NULL should use IS_ERR_OR_NULL()
This version adds documentation to clarify the return value contracts,
making it easier for maintainers to validate future changes.
Return Value Analysis
After thorough code analysis, the RPC functions are categorized as:
Never return NULL (use IS_ERR):**
- r535_gsp_msgq_peek()
- r535_gsp_msgq_recv_one_elem()
- r535_gsp_rpc_get()
CAN return NULL (use IS_ERR_OR_NULL):**
- r535_gsp_msgq_recv() - returns NULL when RPC length is invalid
- r535_gsp_msg_recv() - returns NULL when queue drained
- r535_gsp_rpc_handle_reply() - returns NULL for NOWAIT/NOSEQ policies
- r535_gsp_rpc_send() - can return NULL via handle_reply
- r535_gsp_rpc_push() - can return NULL via handle_reply
Changes in v2
- Added kernel-doc comments documenting return value contracts for all
RPC functions
- Cleaned up incorrect IS_ERR_OR_NULL() usage for functions that never
return NULL
- Kept IS_ERR_OR_NULL() in places where NULL is actually possible
- Added Fixes tags to all patches
Testing
This fixes the NULL pointer dereference oops that occurs during
nouveau initialization on some systems.
Patches
Hongling Zeng (5):
nouveau/gsp/rpc: Document RPC function return value contracts
nouveau/gsp/rpc: Cleanup incorrect IS_ERR_OR_NULL in rpc.c
nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage
nouveau/gsp/rm/bar: Cleanup IS_ERR_OR_NULL usage
nouveau/gsp: Cleanup IS_ERR_OR_NULL in nvkm_gsp_rpc_rd()
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c | 81 ++++++++++++++++++-
4 files changed, 81 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage
2026-06-22 8:11 [PATCH v5 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage Hongling Zeng
@ 2026-06-29 8:36 ` Hongling Zeng
0 siblings, 0 replies; 3+ messages in thread
From: Hongling Zeng @ 2026-06-29 8:36 UTC (permalink / raw)
To: lyude, dakr, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, airlied, ttabi, bskeggs, dri-devel
Cc: Hongling Zeng, nouveau, linux-kernel
Hi
Sorry for the noise. The v5 patch fully addresses all documentation
issues and passes AI testing with no code changes. A similar fix
"sunrpc: Fix error handling in
rpc_sysfs_xprt_switch_add_xprt_store()" has already been accepted by
the community.
Please review when you have time.
Thanks!
在 2026年06月22日 16:11, Hongling Zeng 写道:
> This series addresses feedback from Danilo Krummrich and Timur Tabi
> regarding the use of IS_ERR() vs IS_ERR_OR_NULL() in the nouveau
> GSP RPC code.
>
> The key insight is that we should align error checking with the actual
> return value contracts of each function:
> - Functions that never return NULL should use IS_ERR()
> - Functions that can return NULL should use IS_ERR_OR_NULL()
>
> This version adds documentation to clarify the return value contracts,
> making it easier for maintainers to validate future changes.
>
> Return Value Analysis
>
> After thorough code analysis, the RPC functions are categorized as:
>
> Never return NULL (use IS_ERR):**
> - r535_gsp_msgq_peek()
> - r535_gsp_msgq_recv_one_elem()
> - r535_gsp_rpc_get()
>
> CAN return NULL (use IS_ERR_OR_NULL):**
> - r535_gsp_msgq_recv() - returns NULL when RPC length is invalid
> - r535_gsp_msg_recv() - returns NULL when queue drained
> - r535_gsp_rpc_handle_reply() - returns NULL for NOWAIT/NOSEQ policies
> - r535_gsp_rpc_send() - can return NULL via handle_reply
> - r535_gsp_rpc_push() - can return NULL via handle_reply
>
> Changes in v2
>
> - Added kernel-doc comments documenting return value contracts for all
> RPC functions
> - Cleaned up incorrect IS_ERR_OR_NULL() usage for functions that never
> return NULL
> - Kept IS_ERR_OR_NULL() in places where NULL is actually possible
> - Added Fixes tags to all patches
>
> Testing
>
> This fixes the NULL pointer dereference oops that occurs during
> nouveau initialization on some systems.
>
> Patches
>
> Hongling Zeng (5):
> nouveau/gsp/rpc: Document RPC function return value contracts
> nouveau/gsp/rpc: Cleanup incorrect IS_ERR_OR_NULL in rpc.c
> nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage
> nouveau/gsp/rm/bar: Cleanup IS_ERR_OR_NULL usage
> nouveau/gsp: Cleanup IS_ERR_OR_NULL in nvkm_gsp_rpc_rd()
>
> drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 2 +-
> .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c | 2 +-
> .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c | 2 +-
> .../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c | 81 ++++++++++++++++++-
> 4 files changed, 81 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v5 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage
@ 2026-06-22 8:11 Hongling Zeng
0 siblings, 0 replies; 3+ messages in thread
From: Hongling Zeng @ 2026-06-22 8:11 UTC (permalink / raw)
To: lyude, dakr, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, airlied, ttabi, bskeggs, dri-devel
Cc: nouveau, linux-kernel, zhongling0719, Hongling Zeng
This series addresses feedback from Danilo Krummrich and Timur Tabi
regarding the use of IS_ERR() vs IS_ERR_OR_NULL() in the nouveau
GSP RPC code.
The key insight is that we should align error checking with the actual
return value contracts of each function:
- Functions that never return NULL should use IS_ERR()
- Functions that can return NULL should use IS_ERR_OR_NULL()
This version adds documentation to clarify the return value contracts,
making it easier for maintainers to validate future changes.
Return Value Analysis
After thorough code analysis, the RPC functions are categorized as:
Never return NULL (use IS_ERR):**
- r535_gsp_msgq_peek()
- r535_gsp_msgq_recv_one_elem()
- r535_gsp_rpc_get()
CAN return NULL (use IS_ERR_OR_NULL):**
- r535_gsp_msgq_recv() - returns NULL when RPC length is invalid
- r535_gsp_msg_recv() - returns NULL when queue drained
- r535_gsp_rpc_handle_reply() - returns NULL for NOWAIT/NOSEQ policies
- r535_gsp_rpc_send() - can return NULL via handle_reply
- r535_gsp_rpc_push() - can return NULL via handle_reply
Changes in v2
- Added kernel-doc comments documenting return value contracts for all
RPC functions
- Cleaned up incorrect IS_ERR_OR_NULL() usage for functions that never
return NULL
- Kept IS_ERR_OR_NULL() in places where NULL is actually possible
- Added Fixes tags to all patches
Testing
This fixes the NULL pointer dereference oops that occurs during
nouveau initialization on some systems.
Patches
Hongling Zeng (5):
nouveau/gsp/rpc: Document RPC function return value contracts
nouveau/gsp/rpc: Cleanup incorrect IS_ERR_OR_NULL in rpc.c
nouveau/gsp/rm/alloc: Cleanup IS_ERR_OR_NULL usage
nouveau/gsp/rm/bar: Cleanup IS_ERR_OR_NULL usage
nouveau/gsp: Cleanup IS_ERR_OR_NULL in nvkm_gsp_rpc_rd()
drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/alloc.c | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/bar.c | 2 +-
.../gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c | 81 ++++++++++++++++++-
4 files changed, 81 insertions(+), 6 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-29 8:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 8:11 [PATCH v5 0/5] nouveau/gsp: Clean up IS_ERR vs IS_ERR_OR_NULL usage Hongling Zeng
2026-06-29 8:36 ` Hongling Zeng
-- strict thread matches above, loose matches on Subject: below --
2026-06-22 8:11 Hongling Zeng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.