diff mbox

[v2,05/15] net: wireless: ti: Return flow can be simplified for wl1271_cmd_interrogate

Message ID 1445454428-12331-1-git-send-email-punitvara@gmail.com
State Awaiting Upstream, archived
Delegated to: David Miller
Headers show

Commit Message

Punit Vara Oct. 21, 2015, 7:07 p.m. UTC
Remove int ret suggested by kbuild test robot

This patch is to the wlcore/acx.c file that fixes up warning
reported by coccicheck:

WARNING: end returns can be simplified if negative or 0 value

Prefer direct return value instead of writing 2-3 more sentence.

Signed-off-by: Punit Vara <punitvara@gmail.com>
---
 drivers/net/wireless/ti/wlcore/acx.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Sergei Shtylyov Oct. 21, 2015, 10 p.m. UTC | #1
On 10/21/2015 10:07 PM, Punit Vara wrote:

> Remove int ret suggested by kbuild test robot
>
> This patch is to the wlcore/acx.c file that fixes up warning
> reported by coccicheck:
>
> WARNING: end returns can be simplified if negative or 0 value
>
> Prefer direct return value instead of writing 2-3 more sentence.
>
> Signed-off-by: Punit Vara <punitvara@gmail.com>
> ---
>   drivers/net/wireless/ti/wlcore/acx.c | 7 +------
>   1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
> index f28fa3b..6b566d9 100644
> --- a/drivers/net/wireless/ti/wlcore/acx.c
> +++ b/drivers/net/wireless/ti/wlcore/acx.c
> @@ -158,16 +158,11 @@ out:
>   int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
>   		       size_t len)
>   {
> -	int ret;
>

    You now need to kill this empty line as well.

[...]

MBR, Sergei+

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eliad Peller Oct. 22, 2015, 6:54 a.m. UTC | #2
On Wed, Oct 21, 2015 at 10:07 PM, Punit Vara <punitvara@gmail.com> wrote:
> Remove int ret suggested by kbuild test robot
>
> This patch is to the wlcore/acx.c file that fixes up warning
> reported by coccicheck:
>
> WARNING: end returns can be simplified if negative or 0 value
>
> Prefer direct return value instead of writing 2-3 more sentence.
>
> Signed-off-by: Punit Vara <punitvara@gmail.com>
> ---
>  drivers/net/wireless/ti/wlcore/acx.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
> index f28fa3b..6b566d9 100644
> --- a/drivers/net/wireless/ti/wlcore/acx.c
> +++ b/drivers/net/wireless/ti/wlcore/acx.c
> @@ -158,16 +158,11 @@ out:
>  int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
>                        size_t len)
>  {
> -       int ret;
>
>         wl1271_debug(DEBUG_ACX, "acx mem map");
>
> -       ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
> +       return wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
>                                      sizeof(struct acx_header), len);
> -       if (ret < 0)
> -               return ret;
> -
> -       return 0;
>  }
>
this changes the return value in case of positive values.
have you verified it can't happen / won't affect the code flow?
i'm not sure you really want to blindly patch it...

Eliad.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wlcore/acx.c b/drivers/net/wireless/ti/wlcore/acx.c
index f28fa3b..6b566d9 100644
--- a/drivers/net/wireless/ti/wlcore/acx.c
+++ b/drivers/net/wireless/ti/wlcore/acx.c
@@ -158,16 +158,11 @@  out:
 int wl1271_acx_mem_map(struct wl1271 *wl, struct acx_header *mem_map,
 		       size_t len)
 {
-	int ret;
 
 	wl1271_debug(DEBUG_ACX, "acx mem map");
 
-	ret = wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
+	return wl1271_cmd_interrogate(wl, ACX_MEM_MAP, mem_map,
 				     sizeof(struct acx_header), len);
-	if (ret < 0)
-		return ret;
-
-	return 0;
 }
 
 int wl1271_acx_rx_msdu_life_time(struct wl1271 *wl)