From: Chuck Lever Date: Wed, 28 Jan 2026 15:19:22 +0000 (-0500) Subject: lockd: Simplify cast_status() in svcproc.c X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa772bcc40e1722302b05045d96c0169ac5a2717;p=thirdparty%2Fkernel%2Fstable.git lockd: Simplify cast_status() in svcproc.c Clean up: The svcproc.c file handles only NLM v1 and v3 requests. NLMv4 requests are routed to a separate procedure table in svc4proc.c, so rqstp->rq_vers can never be 4 in this context. Remove the unused vers parameter and the dead "vers != 4" check from cast_to_nlm(). This eliminates the need for the macro wrapper. Reviewed-by: Jeff Layton Signed-off-by: Chuck Lever --- diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 5817ef272332d..95c6bf7ab7574 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c @@ -17,32 +17,30 @@ #define NLMDBG_FACILITY NLMDBG_CLIENT #ifdef CONFIG_LOCKD_V4 -static __be32 -cast_to_nlm(__be32 status, u32 vers) +static inline __be32 cast_status(__be32 status) { - /* Note: status is assumed to be in network byte order !!! */ - if (vers != 4){ - switch (status) { - case nlm_granted: - case nlm_lck_denied: - case nlm_lck_denied_nolocks: - case nlm_lck_blocked: - case nlm_lck_denied_grace_period: - case nlm_drop_reply: - break; - case nlm4_deadlock: - status = nlm_lck_denied; - break; - default: - status = nlm_lck_denied_nolocks; - } + switch (status) { + case nlm_granted: + case nlm_lck_denied: + case nlm_lck_denied_nolocks: + case nlm_lck_blocked: + case nlm_lck_denied_grace_period: + case nlm_drop_reply: + break; + case nlm4_deadlock: + status = nlm_lck_denied; + break; + default: + status = nlm_lck_denied_nolocks; } - return (status); + return status; } -#define cast_status(status) (cast_to_nlm(status, rqstp->rq_vers)) #else -#define cast_status(status) (status) +static inline __be32 cast_status(__be32 status) +{ + return status; +} #endif /*