diff mbox

[3/3] mmc: host: sdhci: Use BUG_ON()

Message ID 1431207891-21448-3-git-send-email-festevam@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam May 9, 2015, 9:44 p.m. UTC
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(-)

Comments

Ulf Hansson May 11, 2015, 10:31 a.m. UTC | #1
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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" 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/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);