diff mbox series

net/ulp: remove unnecessary assignment in tcp_register_ulp

Message ID 20240701114240.7020-1-liujing@cmss.chinamobile.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net/ulp: remove unnecessary assignment in tcp_register_ulp | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 839 this patch: 839
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang fail Errors and warnings before: 846 this patch: 849
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 846 this patch: 846
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Liu Jing July 1, 2024, 11:42 a.m. UTC
in the tcp_register_ulp function, the initialized value of 'ret' is unused,
because it will be assigned a value by the -EEXIST.thus remove it.

Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
---
 net/ipv4/tcp_ulp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michal Kubiak July 1, 2024, 12:52 p.m. UTC | #1
On Mon, Jul 01, 2024 at 07:42:40PM +0800, Liu Jing wrote:
> in the tcp_register_ulp function, the initialized value of 'ret' is unused,
> because it will be assigned a value by the -EEXIST.thus remove it.
> 
> Signed-off-by: Liu Jing <liujing@cmss.chinamobile.com>
> ---
>  net/ipv4/tcp_ulp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
> index 2aa442128630..d11bde357e48 100644
> --- a/net/ipv4/tcp_ulp.c
> +++ b/net/ipv4/tcp_ulp.c
> @@ -58,7 +58,7 @@ static const struct tcp_ulp_ops *__tcp_ulp_find_autoload(const char *name)
>   */
>  int tcp_register_ulp(struct tcp_ulp_ops *ulp)
>  {
> -	int ret = 0;
> +	int ret;
>  
>  	spin_lock(&tcp_ulp_list_lock);
>  	if (tcp_ulp_find(ulp->name))
> -- 
> 2.33.0
> 
> 

As far as I understand the implementation of 'tcp_register_ulp', the only
case when -EEXIST value will be assigned to 'ret' is when
'tcp_ulp_find()' returns true.
In all other cases the return value should be zero.

According to my understanding, uninitialized return value has been
introduced in this patch which is not correct.

Thanks,
Nacked-by: Michal Kubiak <michal.kubiak@intel.com>
diff mbox series

Patch

diff --git a/net/ipv4/tcp_ulp.c b/net/ipv4/tcp_ulp.c
index 2aa442128630..d11bde357e48 100644
--- a/net/ipv4/tcp_ulp.c
+++ b/net/ipv4/tcp_ulp.c
@@ -58,7 +58,7 @@  static const struct tcp_ulp_ops *__tcp_ulp_find_autoload(const char *name)
  */
 int tcp_register_ulp(struct tcp_ulp_ops *ulp)
 {
-	int ret = 0;
+	int ret;
 
 	spin_lock(&tcp_ulp_list_lock);
 	if (tcp_ulp_find(ulp->name))