Re: [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()

2017-10-30 Thread Julian Calaby
Hi Markus,

On Mon, Oct 30, 2017 at 7:16 AM, SF Markus Elfring
 wrote:
> From: Markus Elfring 
> Date: Sun, 29 Oct 2017 20:36:39 +0100
>
> Add a jump target so that a specific error message is stored only once
> at the end of this function implementation.
> Replace two calls of the macro "wl1271_warning" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring 

This patch is bogus, moving error messages around like this is just bizarre.

These are both reporting different failures, so the error messages
should be different.

> ---
>  drivers/net/wireless/ti/wlcore/main.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/main.c 
> b/drivers/net/wireless/ti/wlcore/main.c
> index 12a9d6509382..a110f61110d5 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
> ret = wl1271_configure_suspend(wl, wlvif, wow);
> if (ret < 0) {
> mutex_unlock(>mutex);
> -   wl1271_warning("couldn't prepare device to suspend");

"couldn't configure device for suspend"?

> -   return ret;
> +   goto report_preparation_failure;
> }
> }
>
> @@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
> wl1271_ps_elp_sleep(wl);
> mutex_unlock(>mutex);
>
> -   if (ret < 0) {
> -   wl1271_warning("couldn't prepare device to suspend");

"couldn't enable power saving"?

> -   return ret;
> -   }
> +   if (ret < 0)
> +   goto report_preparation_failure;
>
> /* flush any remaining work */
> wl1271_debug(DEBUG_MAC80211, "flushing remaining works");

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/


Re: [PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()

2017-10-30 Thread Julian Calaby
Hi Markus,

On Mon, Oct 30, 2017 at 7:16 AM, SF Markus Elfring
 wrote:
> From: Markus Elfring 
> Date: Sun, 29 Oct 2017 20:36:39 +0100
>
> Add a jump target so that a specific error message is stored only once
> at the end of this function implementation.
> Replace two calls of the macro "wl1271_warning" by goto statements.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring 

This patch is bogus, moving error messages around like this is just bizarre.

These are both reporting different failures, so the error messages
should be different.

> ---
>  drivers/net/wireless/ti/wlcore/main.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/main.c 
> b/drivers/net/wireless/ti/wlcore/main.c
> index 12a9d6509382..a110f61110d5 100644
> --- a/drivers/net/wireless/ti/wlcore/main.c
> +++ b/drivers/net/wireless/ti/wlcore/main.c
> @@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
> ret = wl1271_configure_suspend(wl, wlvif, wow);
> if (ret < 0) {
> mutex_unlock(>mutex);
> -   wl1271_warning("couldn't prepare device to suspend");

"couldn't configure device for suspend"?

> -   return ret;
> +   goto report_preparation_failure;
> }
> }
>
> @@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
> wl1271_ps_elp_sleep(wl);
> mutex_unlock(>mutex);
>
> -   if (ret < 0) {
> -   wl1271_warning("couldn't prepare device to suspend");

"couldn't enable power saving"?

> -   return ret;
> -   }
> +   if (ret < 0)
> +   goto report_preparation_failure;
>
> /* flush any remaining work */
> wl1271_debug(DEBUG_MAC80211, "flushing remaining works");

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/


[PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()

2017-10-29 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 29 Oct 2017 20:36:39 +0100

Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the macro "wl1271_warning" by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/ti/wlcore/main.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index 12a9d6509382..a110f61110d5 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
ret = wl1271_configure_suspend(wl, wlvif, wow);
if (ret < 0) {
mutex_unlock(>mutex);
-   wl1271_warning("couldn't prepare device to suspend");
-   return ret;
+   goto report_preparation_failure;
}
}
 
@@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
wl1271_ps_elp_sleep(wl);
mutex_unlock(>mutex);
 
-   if (ret < 0) {
-   wl1271_warning("couldn't prepare device to suspend");
-   return ret;
-   }
+   if (ret < 0)
+   goto report_preparation_failure;
 
/* flush any remaining work */
wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
@@ -1783,6 +1780,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
cancel_delayed_work(>tx_watchdog_work);
 
return 0;
+
+report_preparation_failure:
+   wl1271_warning("couldn't prepare device to suspend");
+   return ret;
 }
 
 static int wl1271_op_resume(struct ieee80211_hw *hw)
-- 
2.14.3



[PATCH 5/5] wlcore: Use common error handling code in wl1271_op_suspend()

2017-10-29 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 29 Oct 2017 20:36:39 +0100

Add a jump target so that a specific error message is stored only once
at the end of this function implementation.
Replace two calls of the macro "wl1271_warning" by goto statements.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/net/wireless/ti/wlcore/main.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c 
b/drivers/net/wireless/ti/wlcore/main.c
index 12a9d6509382..a110f61110d5 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1732,8 +1732,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
ret = wl1271_configure_suspend(wl, wlvif, wow);
if (ret < 0) {
mutex_unlock(>mutex);
-   wl1271_warning("couldn't prepare device to suspend");
-   return ret;
+   goto report_preparation_failure;
}
}
 
@@ -1752,10 +1751,8 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
wl1271_ps_elp_sleep(wl);
mutex_unlock(>mutex);
 
-   if (ret < 0) {
-   wl1271_warning("couldn't prepare device to suspend");
-   return ret;
-   }
+   if (ret < 0)
+   goto report_preparation_failure;
 
/* flush any remaining work */
wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
@@ -1783,6 +1780,10 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
cancel_delayed_work(>tx_watchdog_work);
 
return 0;
+
+report_preparation_failure:
+   wl1271_warning("couldn't prepare device to suspend");
+   return ret;
 }
 
 static int wl1271_op_resume(struct ieee80211_hw *hw)
-- 
2.14.3