linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mwifiex: Remove redundant assignment
@ 2021-03-17  6:09 zuoqilin1
  2021-03-17  7:25 ` [EXT] " Sharvari Harisangam
  0 siblings, 1 reply; 2+ messages in thread
From: zuoqilin1 @ 2021-03-17  6:09 UTC (permalink / raw)
  To: amitkarwar, ganapathi017, sharvari.harisangam, huxinming820,
	kvalo, davem, kuba
  Cc: linux-wireless, netdev, linux-kernel, zuoqilin

From: zuoqilin <zuoqilin@yulong.com>

There is no need to define the err variable,
and then assign -EINVAL, we can directly return -EINVAL.

Signed-off-by: zuoqilin <zuoqilin@yulong.com>
---
 drivers/net/wireless/marvell/mwifiex/ie.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c b/drivers/net/wireless/marvell/mwifiex/ie.c
index 40e99ea..c88213c 100644
--- a/drivers/net/wireless/marvell/mwifiex/ie.c
+++ b/drivers/net/wireless/marvell/mwifiex/ie.c
@@ -333,7 +333,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 	u16 gen_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
 	int left_len, parsed_len = 0;
 	unsigned int token_len;
-	int err = 0;
 
 	if (!info->tail || !info->tail_len)
 		return 0;
@@ -351,7 +350,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 		hdr = (void *)(info->tail + parsed_len);
 		token_len = hdr->len + sizeof(struct ieee_types_header);
 		if (token_len > left_len) {
-			err = -EINVAL;
 			goto out;
 		}
 
@@ -377,7 +375,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 			fallthrough;
 		default:
 			if (ie_len + token_len > IEEE_MAX_IE_SIZE) {
-				err = -EINVAL;
 				goto out;
 			}
 			memcpy(gen_ie->ie_buffer + ie_len, hdr, token_len);
@@ -397,7 +394,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 	if (vendorhdr) {
 		token_len = vendorhdr->len + sizeof(struct ieee_types_header);
 		if (ie_len + token_len > IEEE_MAX_IE_SIZE) {
-			err = -EINVAL;
 			goto out;
 		}
 		memcpy(gen_ie->ie_buffer + ie_len, vendorhdr, token_len);
@@ -415,7 +411,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 
 	if (mwifiex_update_uap_custom_ie(priv, gen_ie, &gen_idx, NULL, NULL,
 					 NULL, NULL)) {
-		err = -EINVAL;
 		goto out;
 	}
 
@@ -423,7 +418,7 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
 
  out:
 	kfree(gen_ie);
-	return err;
+	return -EINVAL;
 }
 
 /* This function parses different IEs-head & tail IEs, beacon IEs,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [EXT] [PATCH] mwifiex: Remove redundant assignment
  2021-03-17  6:09 [PATCH] mwifiex: Remove redundant assignment zuoqilin1
@ 2021-03-17  7:25 ` Sharvari Harisangam
  0 siblings, 0 replies; 2+ messages in thread
From: Sharvari Harisangam @ 2021-03-17  7:25 UTC (permalink / raw)
  To: zuoqilin1, amitkarwar, ganapathi017, huxinming820, kvalo, davem, kuba
  Cc: linux-wireless, netdev, linux-kernel, zuoqilin

We need to return 0 in success case. So this can't be removed.

> -----Original Message-----
> From: zuoqilin1@163.com <zuoqilin1@163.com>
> Sent: Wednesday, March 17, 2021 11:40 AM
> To: amitkarwar@gmail.com; ganapathi017@gmail.com; Sharvari Harisangam
> <sharvari.harisangam@nxp.com>; huxinming820@gmail.com;
> kvalo@codeaurora.org; davem@davemloft.net; kuba@kernel.org
> Cc: linux-wireless@vger.kernel.org; netdev@vger.kernel.org; linux-
> kernel@vger.kernel.org; zuoqilin <zuoqilin@yulong.com>
> Subject: [EXT] [PATCH] mwifiex: Remove redundant assignment
> 
> Caution: EXT Email
> 
> From: zuoqilin <zuoqilin@yulong.com>
> 
> There is no need to define the err variable, and then assign -EINVAL, we can
> directly return -EINVAL.
> 
> Signed-off-by: zuoqilin <zuoqilin@yulong.com>
> ---
>  drivers/net/wireless/marvell/mwifiex/ie.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/ie.c
> b/drivers/net/wireless/marvell/mwifiex/ie.c
> index 40e99ea..c88213c 100644
> --- a/drivers/net/wireless/marvell/mwifiex/ie.c
> +++ b/drivers/net/wireless/marvell/mwifiex/ie.c
> @@ -333,7 +333,6 @@ static int mwifiex_uap_parse_tail_ies(struct
> mwifiex_private *priv,
>         u16 gen_idx = MWIFIEX_AUTO_IDX_MASK, ie_len = 0;
>         int left_len, parsed_len = 0;
>         unsigned int token_len;
> -       int err = 0;
> 
>         if (!info->tail || !info->tail_len)
>                 return 0;
> @@ -351,7 +350,6 @@ static int mwifiex_uap_parse_tail_ies(struct
> mwifiex_private *priv,
>                 hdr = (void *)(info->tail + parsed_len);
>                 token_len = hdr->len + sizeof(struct ieee_types_header);
>                 if (token_len > left_len) {
> -                       err = -EINVAL;
>                         goto out;
>                 }
> 
> @@ -377,7 +375,6 @@ static int mwifiex_uap_parse_tail_ies(struct
> mwifiex_private *priv,
>                         fallthrough;
>                 default:
>                         if (ie_len + token_len > IEEE_MAX_IE_SIZE) {
> -                               err = -EINVAL;
>                                 goto out;
>                         }
>                         memcpy(gen_ie->ie_buffer + ie_len, hdr, token_len); @@ -397,7
> +394,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
>         if (vendorhdr) {
>                 token_len = vendorhdr->len + sizeof(struct ieee_types_header);
>                 if (ie_len + token_len > IEEE_MAX_IE_SIZE) {
> -                       err = -EINVAL;
>                         goto out;
>                 }
>                 memcpy(gen_ie->ie_buffer + ie_len, vendorhdr, token_len); @@ -415,7
> +411,6 @@ static int mwifiex_uap_parse_tail_ies(struct mwifiex_private *priv,
> 
>         if (mwifiex_update_uap_custom_ie(priv, gen_ie, &gen_idx, NULL, NULL,
>                                          NULL, NULL)) {
> -               err = -EINVAL;
>                 goto out;
>         }
> 
> @@ -423,7 +418,7 @@ static int mwifiex_uap_parse_tail_ies(struct
> mwifiex_private *priv,
> 
>   out:
>         kfree(gen_ie);
> -       return err;
> +       return -EINVAL;
>  }
> 
>  /* This function parses different IEs-head & tail IEs, beacon IEs,
> --
> 1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-17  7:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17  6:09 [PATCH] mwifiex: Remove redundant assignment zuoqilin1
2021-03-17  7:25 ` [EXT] " Sharvari Harisangam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).