Skip to contentSkip to conversation

mmc: usdhi6rol0: mark expected switch fall-throughs

PATCH Superseded Gustavo A. R. Silva 2 participants 5 messages Mar 20, 2019 – May 1, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: usdhi6rol0: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

In file included from drivers/mmc/host/usdhi6rol0.c:9:
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_timeout_work’:
./include/linux/device.h:1483:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/usdhi6rol0.c:1689:3: note: in expansion of macro ‘dev_err’
dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
^~~~~~~
drivers/mmc/host/usdhi6rol0.c:1691:2: note: here
case USDHI6_WAIT_FOR_CMD:
^~~~
drivers/mmc/host/usdhi6rol0.c:1711:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
usdhi6_sg_unmap(host, true);
^~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/usdhi6rol0.c:1716:2: note: here
case USDHI6_WAIT_FOR_DATA_END:
^~~~
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_stop_cmd’:
drivers/mmc/host/usdhi6rol0.c:1338:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (mrq->stop->opcode == MMC_STOP_TRANSMISSION) {
      ^

drivers/mmc/host/usdhi6rol0.c:1343:2: note: here
default:
^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 drivers/mmc/host/usdhi6rol0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +3 -1
index cd8b1b9d4d8a..b9712ac96be5 100644
@@ -1339,7 +1339,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
 			host->wait = USDHI6_WAIT_FOR_STOP;
 			return 0;
 		}
-		/* Unsupported STOP command */
+		/* fall through - Unsupported STOP command */
 	default:
 		dev_err(mmc_dev(host->mmc),
 			"unsupported stop CMD%d for CMD%d\n",
@@ -1688,6 +1688,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
 	default:
 		dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
 		/* mrq can be NULL in this actually impossible case */
+		/* fall through */
 	case USDHI6_WAIT_FOR_CMD:
 		usdhi6_error_code(host);
 		if (mrq)
@@ -1713,6 +1714,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
 		 * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
 		 * the page
 		 */
+		/* fall through */
 	case USDHI6_WAIT_FOR_DATA_END:
 		usdhi6_error_code(host);
 		data->error = -ETIMEDOUT;
Signature · 1 line
2.21.0
#1 lore raw
Quoted 55 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

In file included from drivers/mmc/host/usdhi6rol0.c:9:
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_timeout_work’:
./include/linux/device.h:1483:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/usdhi6rol0.c:1689:3: note: in expansion of macro ‘dev_err’

   dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
   ^~~~~~~

drivers/mmc/host/usdhi6rol0.c:1691:2: note: here
case USDHI6_WAIT_FOR_CMD:
^~~~
drivers/mmc/host/usdhi6rol0.c:1711:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

   usdhi6_sg_unmap(host, true);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/mmc/host/usdhi6rol0.c:1716:2: note: here
case USDHI6_WAIT_FOR_DATA_END:
^~~~
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_stop_cmd’:
drivers/mmc/host/usdhi6rol0.c:1338:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (mrq->stop->opcode == MMC_STOP_TRANSMISSION) {
      ^

drivers/mmc/host/usdhi6rol0.c:1343:2: note: here
default:
^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 drivers/mmc/host/usdhi6rol0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +1 -1
index cd8b1b9d4d8a..b9712ac96be5 100644
@@ -1339,7 +1339,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
                        host->wait = USDHI6_WAIT_FOR_STOP;
                        return 0;
                }
-               /* Unsupported STOP command */
+               /* fall through - Unsupported STOP command */
        default:
                dev_err(mmc_dev(host->mmc),
                        "unsupported stop CMD%d for CMD%d\n",

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1691

Quoted 4 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
@@ -1688,6 +1688,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
                /* mrq can be NULL in this actually impossible case */
+               /* fall through */

Please make this one comment.

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1717

Quoted 8 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,6 +1714,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                 * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
                 * the page
                 */
+               /* fall through */

Ditto.

Quoted 6 lines
drivers/mmc/host/usdhi6rol0.c +0 -1
        case USDHI6_WAIT_FOR_DATA_END:
                usdhi6_error_code(host);
                data->error = -ETIMEDOUT;
--

2.21.0

Kind regards
Uffe

#2 lore raw
Quoted 64 lines · Ulf Hansson
Quoted 55 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

In file included from drivers/mmc/host/usdhi6rol0.c:9:
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_timeout_work’:
./include/linux/device.h:1483:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
_dev_err(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/mmc/host/usdhi6rol0.c:1689:3: note: in expansion of macro ‘dev_err’

   dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
   ^~~~~~~

drivers/mmc/host/usdhi6rol0.c:1691:2: note: here
case USDHI6_WAIT_FOR_CMD:
^~~~
drivers/mmc/host/usdhi6rol0.c:1711:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

   usdhi6_sg_unmap(host, true);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~

drivers/mmc/host/usdhi6rol0.c:1716:2: note: here
case USDHI6_WAIT_FOR_DATA_END:
^~~~
drivers/mmc/host/usdhi6rol0.c: In function ‘usdhi6_stop_cmd’:
drivers/mmc/host/usdhi6rol0.c:1338:6: warning: this statement may fall through [-Wimplicit-fallthrough=]

   if (mrq->stop->opcode == MMC_STOP_TRANSMISSION) {
      ^

drivers/mmc/host/usdhi6rol0.c:1343:2: note: here
default:
^~~~~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 drivers/mmc/host/usdhi6rol0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +1 -1
index cd8b1b9d4d8a..b9712ac96be5 100644
@@ -1339,7 +1339,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
                        host->wait = USDHI6_WAIT_FOR_STOP;
                        return 0;
                }
-               /* Unsupported STOP command */
+               /* fall through - Unsupported STOP command */
        default:
                dev_err(mmc_dev(host->mmc),
                        "unsupported stop CMD%d for CMD%d\n",

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1691

Quoted 4 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
@@ -1688,6 +1688,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
                /* mrq can be NULL in this actually impossible case */
+               /* fall through */

Please make this one comment.

Quoted 11 lines

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1717

Quoted 8 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,6 +1714,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                 * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
                 * the page
                 */
+               /* fall through */

Ditto.

OK. The reason why I didn't do that is because the line would exceed the 80 characters in both cases. But I'll respin if you are OK with that.

Thanks
--
Gustavo

Quoted 10 lines
Quoted 6 lines
drivers/mmc/host/usdhi6rol0.c +0 -1
        case USDHI6_WAIT_FOR_DATA_END:
                usdhi6_error_code(host);
                data->error = -ETIMEDOUT;
--

2.21.0

Kind regards
Uffe

#3 lore raw

[...]

Quoted 20 lines
Quoted 8 lines

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1691

Quoted 5 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
@@ -1688,6 +1688,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
                /* mrq can be NULL in this actually impossible case */
+               /* fall through */

Please make this one comment.

Quoted 11 lines

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1717

Quoted 8 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,6 +1714,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                 * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
                 * the page
                 */
+               /* fall through */

Ditto.

Quoted 3 lines

OK. The reason why I didn't do that is because the line would exceed the 80 characters in both cases. But I'll respin if you are OK with that.

What's wrong with having several lines per comment-section?

Kind regards
Uffe

#4 lore raw
In reply to Ulf Hansson

Hi Ulf,

Sorry for the late reply, please see my comments below...

Quoted 7 lines · Ulf Hansson
Quoted 5 lines · Gustavo A. R. Silva

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

[..]

Quoted 23 lines
Quoted 23 lines

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.

---
 drivers/mmc/host/usdhi6rol0.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/host/usdhi6rol0.c +1 -1
index cd8b1b9d4d8a..b9712ac96be5 100644
@@ -1339,7 +1339,7 @@ static int usdhi6_stop_cmd(struct usdhi6_host *host)
                        host->wait = USDHI6_WAIT_FOR_STOP;
                        return 0;
                }
-               /* Unsupported STOP command */
+               /* fall through - Unsupported STOP command */
        default:
                dev_err(mmc_dev(host->mmc),
Quoted 9 lines

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1691

Quoted 6 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
                        "unsupported stop CMD%d for CMD%d\n",
@@ -1688,6 +1688,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
        default:
                dev_err(mmc_dev(host->mmc), "Invalid state %u\n", host->wait);
                /* mrq can be NULL in this actually impossible case */
+               /* fall through */

Please make this one comment.

Sure thing. I can do it, but it will exceed the 80 characters limit.

Quoted 11 lines

drivers/mmc/host/usdhi6rol0.c static void usdhi6_timeout_work(struct work_struct *work) · line 1717

Quoted 8 lines
drivers/mmc/host/usdhi6rol0.c +1 -0
        case USDHI6_WAIT_FOR_CMD:
                usdhi6_error_code(host);
                if (mrq)
@@ -1713,6 +1714,7 @@ static void usdhi6_timeout_work(struct work_struct *work)
                 * If USDHI6_WAIT_FOR_DATA_END times out, we have already unmapped
                 * the page
                 */
+               /* fall through */

Ditto.

The same here.

If you are OK with that I'll send v2, shortly.

Thanks
--
Gustavo