public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence
@ 2015-05-09 21:44 Fabio Estevam
  2015-05-09 21:44 ` [PATCH 2/3] mmc: host: mxcmmc: " Fabio Estevam
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Fabio Estevam @ 2015-05-09 21:44 UTC (permalink / raw)
  To: ulf.hansson; +Cc: linux-mmc, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/simple_return.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mmc/card/mmc_test.c | 100 +++++++-------------------------------------
 1 file changed, 15 insertions(+), 85 deletions(-)

diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
index 53b7413..5e90b3f 100644
--- a/drivers/mmc/card/mmc_test.c
+++ b/drivers/mmc/card/mmc_test.c
@@ -268,8 +268,6 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
 static int mmc_test_buffer_transfer(struct mmc_test_card *test,
 	u8 *buffer, unsigned addr, unsigned blksz, int write)
 {
-	int ret;
-
 	struct mmc_request mrq = {0};
 	struct mmc_command cmd = {0};
 	struct mmc_command stop = {0};
@@ -292,11 +290,7 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test,
 	if (data.error)
 		return data.error;
 
-	ret = mmc_test_wait_busy(test);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_wait_busy(test);
 }
 
 static void mmc_test_free_mem(struct mmc_test_mem *mem)
@@ -994,11 +988,7 @@ static int mmc_test_basic_write(struct mmc_test_card *test)
 
 	sg_init_one(&sg, test->buffer, 512);
 
-	ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
 }
 
 static int mmc_test_basic_read(struct mmc_test_card *test)
@@ -1012,44 +1002,29 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
 
 	sg_init_one(&sg, test->buffer, 512);
 
-	ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
 }
 
 static int mmc_test_verify_write(struct mmc_test_card *test)
 {
-	int ret;
 	struct scatterlist sg;
 
 	sg_init_one(&sg, test->buffer, 512);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
 }
 
 static int mmc_test_verify_read(struct mmc_test_card *test)
 {
-	int ret;
 	struct scatterlist sg;
 
 	sg_init_one(&sg, test->buffer, 512);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
 }
 
 static int mmc_test_multi_write(struct mmc_test_card *test)
 {
-	int ret;
 	unsigned int size;
 	struct scatterlist sg;
 
@@ -1066,16 +1041,11 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
 
 	sg_init_one(&sg, test->buffer, size);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
 }
 
 static int mmc_test_multi_read(struct mmc_test_card *test)
 {
-	int ret;
 	unsigned int size;
 	struct scatterlist sg;
 
@@ -1092,11 +1062,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
 
 	sg_init_one(&sg, test->buffer, size);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
 }
 
 static int mmc_test_pow2_write(struct mmc_test_card *test)
@@ -1263,11 +1229,7 @@ static int mmc_test_xfersize_write(struct mmc_test_card *test)
 	if (ret)
 		return ret;
 
-	ret = mmc_test_broken_transfer(test, 1, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_broken_transfer(test, 1, 512, 1);
 }
 
 static int mmc_test_xfersize_read(struct mmc_test_card *test)
@@ -1278,11 +1240,7 @@ static int mmc_test_xfersize_read(struct mmc_test_card *test)
 	if (ret)
 		return ret;
 
-	ret = mmc_test_broken_transfer(test, 1, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_broken_transfer(test, 1, 512, 0);
 }
 
 static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
@@ -1296,11 +1254,7 @@ static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
 	if (ret)
 		return ret;
 
-	ret = mmc_test_broken_transfer(test, 2, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_broken_transfer(test, 2, 512, 1);
 }
 
 static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
@@ -1314,48 +1268,33 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
 	if (ret)
 		return ret;
 
-	ret = mmc_test_broken_transfer(test, 2, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_broken_transfer(test, 2, 512, 0);
 }
 
 #ifdef CONFIG_HIGHMEM
 
 static int mmc_test_write_high(struct mmc_test_card *test)
 {
-	int ret;
 	struct scatterlist sg;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, test->highmem, 512, 0);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
 }
 
 static int mmc_test_read_high(struct mmc_test_card *test)
 {
-	int ret;
 	struct scatterlist sg;
 
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, test->highmem, 512, 0);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
 }
 
 static int mmc_test_multi_write_high(struct mmc_test_card *test)
 {
-	int ret;
 	unsigned int size;
 	struct scatterlist sg;
 
@@ -1373,16 +1312,11 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, test->highmem, size, 0);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
 }
 
 static int mmc_test_multi_read_high(struct mmc_test_card *test)
 {
-	int ret;
 	unsigned int size;
 	struct scatterlist sg;
 
@@ -1400,11 +1334,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
 	sg_init_table(&sg, 1);
 	sg_set_page(&sg, test->highmem, size, 0);
 
-	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
-	if (ret)
-		return ret;
-
-	return 0;
+	return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
 }
 
 #else
-- 
1.9.1


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

* [PATCH 2/3] mmc: host: mxcmmc: Simplify a trivial if-return sequence
  2015-05-09 21:44 [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Fabio Estevam
@ 2015-05-09 21:44 ` Fabio Estevam
  2015-05-11 10:30   ` Ulf Hansson
  2015-05-09 21:44 ` [PATCH 3/3] mmc: host: sdhci: Use BUG_ON() Fabio Estevam
  2015-05-11 10:30 ` [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2015-05-09 21:44 UTC (permalink / raw)
  To: ulf.hansson; +Cc: linux-mmc, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Simplify a trivial if-return sequence. Possibly combine with a
preceding function call.

The semantic patch that makes this change is available
in scripts/coccinelle/misc/simple_return.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mmc/host/mxcmmc.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 317d709..d110f9e 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -605,11 +605,7 @@ static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes)
 		mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS);
 	}
 
-	stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
-	if (stat)
-		return stat;
-
-	return 0;
+	return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
 }
 
 static int mxcmci_transfer_data(struct mxcmci_host *host)
-- 
1.9.1


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

* [PATCH 3/3] mmc: host: sdhci: Use BUG_ON()
  2015-05-09 21:44 [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Fabio Estevam
  2015-05-09 21:44 ` [PATCH 2/3] mmc: host: mxcmmc: " Fabio Estevam
@ 2015-05-09 21:44 ` Fabio Estevam
  2015-05-11 10:31   ` Ulf Hansson
  2015-05-11 10:30 ` [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Ulf Hansson
  2 siblings, 1 reply; 6+ messages in thread
From: Fabio Estevam @ 2015-05-09 21:44 UTC (permalink / raw)
  To: ulf.hansson; +Cc: linux-mmc, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Use BUG_ON() instead of an 'if' condition followed by BUG().

The semantic patch that makes this change is available
in scripts/coccinelle/misc/bugon.cocci.

More information about semantic patching is available at
http://coccinelle.lip6.fr/

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/mmc/host/sdhci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c80287a..8d97fe0 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -328,8 +328,7 @@ static void sdhci_read_block_pio(struct sdhci_host *host)
 	local_irq_save(flags);
 
 	while (blksize) {
-		if (!sg_miter_next(&host->sg_miter))
-			BUG();
+		BUG_ON(!sg_miter_next(&host->sg_miter));
 
 		len = min(host->sg_miter.length, blksize);
 
@@ -374,8 +373,7 @@ static void sdhci_write_block_pio(struct sdhci_host *host)
 	local_irq_save(flags);
 
 	while (blksize) {
-		if (!sg_miter_next(&host->sg_miter))
-			BUG();
+		BUG_ON(!sg_miter_next(&host->sg_miter));
 
 		len = min(host->sg_miter.length, blksize);
 
-- 
1.9.1


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

* Re: [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence
  2015-05-09 21:44 [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Fabio Estevam
  2015-05-09 21:44 ` [PATCH 2/3] mmc: host: mxcmmc: " Fabio Estevam
  2015-05-09 21:44 ` [PATCH 3/3] mmc: host: sdhci: Use BUG_ON() Fabio Estevam
@ 2015-05-11 10:30 ` Ulf Hansson
  2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-05-11 10:30 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux-mmc, Fabio Estevam

On 9 May 2015 at 23:44, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/misc/simple_return.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks, applied!

Kind regards
Uffe

> ---
>  drivers/mmc/card/mmc_test.c | 100 +++++++-------------------------------------
>  1 file changed, 15 insertions(+), 85 deletions(-)
>
> diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c
> index 53b7413..5e90b3f 100644
> --- a/drivers/mmc/card/mmc_test.c
> +++ b/drivers/mmc/card/mmc_test.c
> @@ -268,8 +268,6 @@ static int mmc_test_wait_busy(struct mmc_test_card *test)
>  static int mmc_test_buffer_transfer(struct mmc_test_card *test,
>         u8 *buffer, unsigned addr, unsigned blksz, int write)
>  {
> -       int ret;
> -
>         struct mmc_request mrq = {0};
>         struct mmc_command cmd = {0};
>         struct mmc_command stop = {0};
> @@ -292,11 +290,7 @@ static int mmc_test_buffer_transfer(struct mmc_test_card *test,
>         if (data.error)
>                 return data.error;
>
> -       ret = mmc_test_wait_busy(test);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_wait_busy(test);
>  }
>
>  static void mmc_test_free_mem(struct mmc_test_mem *mem)
> @@ -994,11 +988,7 @@ static int mmc_test_basic_write(struct mmc_test_card *test)
>
>         sg_init_one(&sg, test->buffer, 512);
>
> -       ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
>  }
>
>  static int mmc_test_basic_read(struct mmc_test_card *test)
> @@ -1012,44 +1002,29 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
>
>         sg_init_one(&sg, test->buffer, 512);
>
> -       ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
>  }
>
>  static int mmc_test_verify_write(struct mmc_test_card *test)
>  {
> -       int ret;
>         struct scatterlist sg;
>
>         sg_init_one(&sg, test->buffer, 512);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
>  }
>
>  static int mmc_test_verify_read(struct mmc_test_card *test)
>  {
> -       int ret;
>         struct scatterlist sg;
>
>         sg_init_one(&sg, test->buffer, 512);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
>  }
>
>  static int mmc_test_multi_write(struct mmc_test_card *test)
>  {
> -       int ret;
>         unsigned int size;
>         struct scatterlist sg;
>
> @@ -1066,16 +1041,11 @@ static int mmc_test_multi_write(struct mmc_test_card *test)
>
>         sg_init_one(&sg, test->buffer, size);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
>  }
>
>  static int mmc_test_multi_read(struct mmc_test_card *test)
>  {
> -       int ret;
>         unsigned int size;
>         struct scatterlist sg;
>
> @@ -1092,11 +1062,7 @@ static int mmc_test_multi_read(struct mmc_test_card *test)
>
>         sg_init_one(&sg, test->buffer, size);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
>  }
>
>  static int mmc_test_pow2_write(struct mmc_test_card *test)
> @@ -1263,11 +1229,7 @@ static int mmc_test_xfersize_write(struct mmc_test_card *test)
>         if (ret)
>                 return ret;
>
> -       ret = mmc_test_broken_transfer(test, 1, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_broken_transfer(test, 1, 512, 1);
>  }
>
>  static int mmc_test_xfersize_read(struct mmc_test_card *test)
> @@ -1278,11 +1240,7 @@ static int mmc_test_xfersize_read(struct mmc_test_card *test)
>         if (ret)
>                 return ret;
>
> -       ret = mmc_test_broken_transfer(test, 1, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_broken_transfer(test, 1, 512, 0);
>  }
>
>  static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
> @@ -1296,11 +1254,7 @@ static int mmc_test_multi_xfersize_write(struct mmc_test_card *test)
>         if (ret)
>                 return ret;
>
> -       ret = mmc_test_broken_transfer(test, 2, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_broken_transfer(test, 2, 512, 1);
>  }
>
>  static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
> @@ -1314,48 +1268,33 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
>         if (ret)
>                 return ret;
>
> -       ret = mmc_test_broken_transfer(test, 2, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_broken_transfer(test, 2, 512, 0);
>  }
>
>  #ifdef CONFIG_HIGHMEM
>
>  static int mmc_test_write_high(struct mmc_test_card *test)
>  {
> -       int ret;
>         struct scatterlist sg;
>
>         sg_init_table(&sg, 1);
>         sg_set_page(&sg, test->highmem, 512, 0);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 1);
>  }
>
>  static int mmc_test_read_high(struct mmc_test_card *test)
>  {
> -       int ret;
>         struct scatterlist sg;
>
>         sg_init_table(&sg, 1);
>         sg_set_page(&sg, test->highmem, 512, 0);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, 1, 512, 0);
>  }
>
>  static int mmc_test_multi_write_high(struct mmc_test_card *test)
>  {
> -       int ret;
>         unsigned int size;
>         struct scatterlist sg;
>
> @@ -1373,16 +1312,11 @@ static int mmc_test_multi_write_high(struct mmc_test_card *test)
>         sg_init_table(&sg, 1);
>         sg_set_page(&sg, test->highmem, size, 0);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
>  }
>
>  static int mmc_test_multi_read_high(struct mmc_test_card *test)
>  {
> -       int ret;
>         unsigned int size;
>         struct scatterlist sg;
>
> @@ -1400,11 +1334,7 @@ static int mmc_test_multi_read_high(struct mmc_test_card *test)
>         sg_init_table(&sg, 1);
>         sg_set_page(&sg, test->highmem, size, 0);
>
> -       ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
> -       if (ret)
> -               return ret;
> -
> -       return 0;
> +       return mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
>  }
>
>  #else
> --
> 1.9.1
>

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

* Re: [PATCH 2/3] mmc: host: mxcmmc: Simplify a trivial if-return sequence
  2015-05-09 21:44 ` [PATCH 2/3] mmc: host: mxcmmc: " Fabio Estevam
@ 2015-05-11 10:30   ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-05-11 10:30 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux-mmc, Fabio Estevam

On 9 May 2015 at 23:44, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Simplify a trivial if-return sequence. Possibly combine with a
> preceding function call.
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/misc/simple_return.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks, applied!

Kind regards
Uffe


> ---
>  drivers/mmc/host/mxcmmc.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
> index 317d709..d110f9e 100644
> --- a/drivers/mmc/host/mxcmmc.c
> +++ b/drivers/mmc/host/mxcmmc.c
> @@ -605,11 +605,7 @@ static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes)
>                 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS);
>         }
>
> -       stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
> -       if (stat)
> -               return stat;
> -
> -       return 0;
> +       return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY);
>  }
>
>  static int mxcmci_transfer_data(struct mxcmci_host *host)
> --
> 1.9.1
>

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

* Re: [PATCH 3/3] mmc: host: sdhci: Use BUG_ON()
  2015-05-09 21:44 ` [PATCH 3/3] mmc: host: sdhci: Use BUG_ON() Fabio Estevam
@ 2015-05-11 10:31   ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2015-05-11 10:31 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: linux-mmc, Fabio Estevam

On 9 May 2015 at 23:44, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Use BUG_ON() instead of an 'if' condition followed by BUG().
>
> The semantic patch that makes this change is available
> in scripts/coccinelle/misc/bugon.cocci.
>
> More information about semantic patching is available at
> http://coccinelle.lip6.fr/
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks, applied!

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c80287a..8d97fe0 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -328,8 +328,7 @@ static void sdhci_read_block_pio(struct sdhci_host *host)
>         local_irq_save(flags);
>
>         while (blksize) {
> -               if (!sg_miter_next(&host->sg_miter))
> -                       BUG();
> +               BUG_ON(!sg_miter_next(&host->sg_miter));
>
>                 len = min(host->sg_miter.length, blksize);
>
> @@ -374,8 +373,7 @@ static void sdhci_write_block_pio(struct sdhci_host *host)
>         local_irq_save(flags);
>
>         while (blksize) {
> -               if (!sg_miter_next(&host->sg_miter))
> -                       BUG();
> +               BUG_ON(!sg_miter_next(&host->sg_miter));
>
>                 len = min(host->sg_miter.length, blksize);
>
> --
> 1.9.1
>

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

end of thread, other threads:[~2015-05-11 10:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-09 21:44 [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Fabio Estevam
2015-05-09 21:44 ` [PATCH 2/3] mmc: host: mxcmmc: " Fabio Estevam
2015-05-11 10:30   ` Ulf Hansson
2015-05-09 21:44 ` [PATCH 3/3] mmc: host: sdhci: Use BUG_ON() Fabio Estevam
2015-05-11 10:31   ` Ulf Hansson
2015-05-11 10:30 ` [PATCH 1/3] mmc: card: mmc_test: Simplify a trivial if-return sequence Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox