diff mbox series

[net] net/smc: Fix an error code in smc_lgr_create()

Message ID Y0ktLDGg0CafxS3d@kili (mailing list archive)
State Accepted
Commit bdee15e8c58b450ad736a2b62ef8c7a12548b704
Delegated to: Netdev Maintainers
Headers show
Series [net] net/smc: Fix an error code in smc_lgr_create() | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 9 of 9 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Dan Carpenter Oct. 14, 2022, 9:34 a.m. UTC
If smc_wr_alloc_lgr_mem() fails then return an error code.  Don't return
success.

Fixes: 8799e310fb3f ("net/smc: add v2 support to the work request layer")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 net/smc/smc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Wenjia Zhang Oct. 14, 2022, 11:34 a.m. UTC | #1
On 14.10.22 11:34, Dan Carpenter wrote:
> If smc_wr_alloc_lgr_mem() fails then return an error code.  Don't return
> success.
> 
> Fixes: 8799e310fb3f ("net/smc: add v2 support to the work request layer")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>   net/smc/smc_core.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
> index e6ee797640b4..c305d8dd23f8 100644
> --- a/net/smc/smc_core.c
> +++ b/net/smc/smc_core.c
> @@ -896,7 +896,8 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
>   		}
>   		memcpy(lgr->pnet_id, ibdev->pnetid[ibport - 1],
>   		       SMC_MAX_PNETID_LEN);
> -		if (smc_wr_alloc_lgr_mem(lgr))
> +		rc = smc_wr_alloc_lgr_mem(lgr);
> +		if (rc)
>   			goto free_wq;
>   		smc_llc_lgr_init(lgr, smc);
>   

Good catch! Thank you for your effort!
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
patchwork-bot+netdevbpf@kernel.org Oct. 15, 2022, 10:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Fri, 14 Oct 2022 12:34:36 +0300 you wrote:
> If smc_wr_alloc_lgr_mem() fails then return an error code.  Don't return
> success.
> 
> Fixes: 8799e310fb3f ("net/smc: add v2 support to the work request layer")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  net/smc/smc_core.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net] net/smc: Fix an error code in smc_lgr_create()
    https://git.kernel.org/netdev/net/c/bdee15e8c58b

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index e6ee797640b4..c305d8dd23f8 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -896,7 +896,8 @@  static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)
 		}
 		memcpy(lgr->pnet_id, ibdev->pnetid[ibport - 1],
 		       SMC_MAX_PNETID_LEN);
-		if (smc_wr_alloc_lgr_mem(lgr))
+		rc = smc_wr_alloc_lgr_mem(lgr);
+		if (rc)
 			goto free_wq;
 		smc_llc_lgr_init(lgr, smc);