Skip to contentSkip to conversation

ASoC: ti: davinci-mcasp: Fix fall-through warning for Clang

PATCH Superseded Gustavo A. R. Silva 4 participants 4 messages May 28, 2021 – Jun 4, 2021

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: ti: davinci-mcasp: Fix fall-through warning for Clang

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by explicitly adding a goto statement instead of letting the code fall through to the next case.

---
JFYI: We had thousands of these sorts of warnings and now we are down
to just 25 in linux-next. This is one of those last remaining warnings.

 sound/soc/ti/davinci-mcasp.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/ti/davinci-mcasp.c +1 -0
index b94220306d1a..587967720135 100644
@@ -2317,6 +2317,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
+		goto err;
 	case -EPROBE_DEFER:
 		goto err;
 	}
Signature · 1 line
2.27.0
#2 lore raw
In reply to Gustavo A. R. Silva
Quoted 19 lines · Gustavo A. R. Silva

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by explicitly adding a goto statement instead of letting the code fall through to the next case.

---
JFYI: We had thousands of these sorts of warnings and now we are down
to just 25 in linux-next. This is one of those last remaining warnings.

 sound/soc/ti/davinci-mcasp.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/ti/davinci-mcasp.c +0 -0
index b94220306d1a..587967720135 100644

sound/soc/ti/davinci-mcasp.c static int davinci_mcasp_probe(struct platform_device *pdev) · line 2320

Quoted 4 lines
sound/soc/ti/davinci-mcasp.c +1 -0
@@ -2317,6 +2317,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
+		goto err;

Would:

	fallthrough;

be enough to silence the warning? If so, then I would prefer this version.

Quoted 4 lines
sound/soc/ti/davinci-mcasp.c +0 -0
 	case -EPROBE_DEFER:
 		goto err;
 	}
Signature · 1 line
Péter
#3 lore raw
Quoted 28 lines · Péter Ujfalusi
Quoted 19 lines · Gustavo A. R. Silva

In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by explicitly adding a goto statement instead of letting the code fall through to the next case.

---
JFYI: We had thousands of these sorts of warnings and now we are down
to just 25 in linux-next. This is one of those last remaining warnings.

 sound/soc/ti/davinci-mcasp.c | 1 +
 1 file changed, 1 insertion(+)
sound/soc/ti/davinci-mcasp.c +0 -0
index b94220306d1a..587967720135 100644

sound/soc/ti/davinci-mcasp.c static int davinci_mcasp_probe(struct platform_device *pdev) · line 2320

Quoted 4 lines
sound/soc/ti/davinci-mcasp.c +1 -0
@@ -2317,6 +2317,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		break;
 	default:
 		dev_err(&pdev->dev, "No DMA controller found (%d)\n", ret);
+		goto err;

Would:

Quoted 3 lines
	fallthrough;

be enough to silence the warning? If so, then I would prefer this version.

Yep.:) Done:

	https://lore.kernel.org/linux-hardening/20210604072714.GA244640@embeddedor/

Thanks
--
Gustavo