diff mbox

ti: wl18xx: add checks on wl18xx_top_reg_write() return value

Message ID 20170626230619.GA14831@embeddedgus (mailing list archive)
State Accepted
Commit 059c98599b1ab1e2e479e1f4617948d4c2a32b84
Delegated to: Kalle Valo
Headers show

Commit Message

Gustavo A. R. Silva June 26, 2017, 11:06 p.m. UTC
Check return value from call to wl18xx_top_reg_write(),
so in case of error jump to goto label out and return.

Also, remove unnecessary value check before goto label out.

Addresses-Coverity-ID: 1226938
Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 drivers/net/wireless/ti/wl18xx/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Kalle Valo June 28, 2017, 4:38 p.m. UTC | #1
"Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:

> Check return value from call to wl18xx_top_reg_write(),
> so in case of error jump to goto label out and return.
> 
> Also, remove unnecessary value check before goto label out.
> 
> Addresses-Coverity-ID: 1226938
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

The prefix should be "wl18xx:", I'll fix that.
Kalle Valo June 28, 2017, 6:18 p.m. UTC | #2
"Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:

> Check return value from call to wl18xx_top_reg_write(),
> so in case of error jump to goto label out and return.
> 
> Also, remove unnecessary value check before goto label out.
> 
> Addresses-Coverity-ID: 1226938
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Patch applied to wireless-drivers-next.git, thanks.

059c98599b1a wl18xx: add checks on wl18xx_top_reg_write() return value
Gustavo A. R. Silva June 28, 2017, 10:57 p.m. UTC | #3
Quoting Kalle Valo <kvalo@codeaurora.org>:

> "Gustavo A. R. Silva" <garsilva@embeddedor.com> wrote:
>
>> Check return value from call to wl18xx_top_reg_write(),
>> so in case of error jump to goto label out and return.
>>
>> Also, remove unnecessary value check before goto label out.
>>
>> Addresses-Coverity-ID: 1226938
>> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
>
> The prefix should be "wl18xx:", I'll fix that.
>

Thanks, Kalle.
--
Gustavo A. R. Silva
diff mbox

Patch

diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index d1aa3ee..0cf3b40 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -793,9 +793,13 @@  static int wl18xx_set_clk(struct wl1271 *wl)
 		ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_P_FACTOR_CFG_2,
 					(wl18xx_clk_table[clk_freq].p >> 16) &
 					PLLSH_WCS_PLL_P_FACTOR_CFG_2_MASK);
+		if (ret < 0)
+			goto out;
 	} else {
 		ret = wl18xx_top_reg_write(wl, PLLSH_WCS_PLL_SWALLOW_EN,
 					   PLLSH_WCS_PLL_SWALLOW_EN_VAL2);
+		if (ret < 0)
+			goto out;
 	}
 
 	/* choose WCS PLL */
@@ -819,8 +823,6 @@  static int wl18xx_set_clk(struct wl1271 *wl)
 	/* reset the swallowing logic */
 	ret = wl18xx_top_reg_write(wl, PLLSH_COEX_PLL_SWALLOW_EN,
 				   PLLSH_COEX_PLL_SWALLOW_EN_VAL2);
-	if (ret < 0)
-		goto out;
 
 out:
 	return ret;