diff mbox

spi/atmel: fix simple_return.cocci warnings

Message ID 543feff0.QhS1UtLsJt/o5948%fengguang.wu@intel.com (mailing list archive)
State Accepted
Commit d0de6ff6b92665c10a93795e9d041a61f64431af
Headers show

Commit Message

Fengguang Wu Oct. 16, 2014, 4:18 p.m. UTC
drivers/spi/spi-atmel.c:1518:1-4: WARNING: end returns can be simpified and declaration on line 1514 can be dropped

 Simplify a trivial if-return sequence.  Possibly combine with a
 preceding function call.
Generated by: scripts/coccinelle/misc/simple_return.cocci

CC: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

Please take the patch only if it's a positive warning. Thanks!

 spi-atmel.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

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

Comments

Mark Brown Oct. 17, 2014, 8:58 a.m. UTC | #1
On Fri, Oct 17, 2014 at 12:18:56AM +0800, Fengguang Wu wrote:
> drivers/spi/spi-atmel.c:1518:1-4: WARNING: end returns can be simpified and declaration on line 1514 can be dropped

Applied, thanks.
Nicolas Ferre Oct. 17, 2014, 9:05 a.m. UTC | #2
On 16/10/2014 18:18, Fengguang Wu :
> drivers/spi/spi-atmel.c:1518:1-4: WARNING: end returns can be simpified and declaration on line 1514 can be dropped
> 
>  Simplify a trivial if-return sequence.  Possibly combine with a
>  preceding function call.
> Generated by: scripts/coccinelle/misc/simple_return.cocci
> 
> CC: Wenyou Yang <wenyou.yang@atmel.com>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
> Please take the patch only if it's a positive warning. Thanks!
> 
>  spi-atmel.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> --- a/drivers/spi/spi-atmel.c
> +++ b/drivers/spi/spi-atmel.c
> @@ -1511,15 +1511,10 @@ static int atmel_spi_runtime_resume(stru
>  {
>  	struct spi_master *master = dev_get_drvdata(dev);
>  	struct atmel_spi *as = spi_master_get_devdata(master);
> -	int ret;
>  
>  	pinctrl_pm_select_default_state(dev);
>  
> -	ret = clk_prepare_enable(as->clk);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> +	return clk_prepare_enable(as->clk);

Indeed:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

>  }
>  #endif
>  
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" 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

--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1511,15 +1511,10 @@  static int atmel_spi_runtime_resume(stru
 {
 	struct spi_master *master = dev_get_drvdata(dev);
 	struct atmel_spi *as = spi_master_get_devdata(master);
-	int ret;
 
 	pinctrl_pm_select_default_state(dev);
 
-	ret = clk_prepare_enable(as->clk);
-	if (ret)
-		return ret;
-
-	return 0;
+	return clk_prepare_enable(as->clk);
 }
 #endif