Skip to contentSkip to conversation

drm/amdgpu/display: add fallthrough comment

PATCH In review Alex Deucher 3 participants 5 messages Dec 5, 2019 – Dec 6, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/display: add fallthrough comment

To avoid a compiler warning.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 -0
index 191b68b8163a..f1a5d2c6aa37 100644
@@ -645,6 +645,7 @@ bool dce_aux_transfer_with_retries(struct ddc_service *ddc,
 			case AUX_TRANSACTION_REPLY_AUX_DEFER:
 			case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:
 				retry_on_defer = true;
+				/* fall through */
 			case AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:
 				if (++aux_defer_retries >= AUX_MAX_DEFER_RETRIES) {
 					goto fail;
Signature · 6 lines
2.23.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw
Quoted 27 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2019/December/05, Thursday 4:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/display: add fallthrough comment

To avoid a compiler warning.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +0 -0
index 191b68b8163a..f1a5d2c6aa37 100644
@@ -645,6 +645,7 @@ bool dce_aux_transfer_with_retries(struct
 ddc_service *ddc,
 			case AUX_TRANSACTION_REPLY_AUX_DEFER:
 			case

AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:

drivers/gpu/drm/amd/display/dc/dce/dce_aux.c bool dce_aux_transfer_with_retries(struct ddc_service *ddc, · line 648

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +1 -0
 				retry_on_defer = true;
+				/* fall through */

I am a bit confusing here. Why a comment can avoid a compiler warning?

Quoted 8 lines

case
AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:
if (++aux_defer_retries >=
AUX_MAX_DEFER_RETRIES) {
goto fail;
--
2.23.0

Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7Czhan.liu%40amd.com%7C77d85a0275aa4c0a78 2f08d779cb9716%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6 37111788208702340&amp;sdata=3m%2FuNuNIgq82z%2BAeXJ9y7wn81kV% 2FiDt3AyC3CDiTRrc%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 18 lines · Zhan
Quoted 18 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2019/December/05, Thursday 4:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/display: add fallthrough comment

To avoid a compiler warning.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +0 -0
index 191b68b8163a..f1a5d2c6aa37 100644
@@ -645,6 +645,7 @@ bool dce_aux_transfer_with_retries(struct
 ddc_service *ddc,
                      case AUX_TRANSACTION_REPLY_AUX_DEFER:
                      case

AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:

Quoted 2 lines
                              retry_on_defer = true;

+ /* fall through */

I am a bit confusing here. Why a comment can avoid a compiler warning?

The kernel enables fall through warnings, so unless there is a comment mentioning that are are expecting to fall through here, we get a warning. The idea is to find missing breaks in switch code.

Alex

Quoted 9 lines
Quoted 9 lines

case
AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:

                              if (++aux_defer_retries >=
AUX_MAX_DEFER_RETRIES) {
                                      goto fail;

--
2.23.0

Quoted 9 lines
Quoted 9 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&amp;data=02%7C01%7Czhan.liu%40amd.com%7C77d85a0275aa4c0a78 2f08d779cb9716%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6 37111788208702340&amp;sdata=3m%2FuNuNIgq82z%2BAeXJ9y7wn81kV% 2FiDt3AyC3CDiTRrc%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#3 lore raw
Quoted 44 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2019/December/05, Thursday 5:13 PM
To: Liu, Zhan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/display: add fallthrough comment

Quoted 18 lines · Zhan
Quoted 18 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2019/December/05, Thursday 4:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/display: add fallthrough comment

To avoid a compiler warning.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +0 -0
index 191b68b8163a..f1a5d2c6aa37 100644
@@ -645,6 +645,7 @@ bool dce_aux_transfer_with_retries(struct
 ddc_service *ddc,
                      case AUX_TRANSACTION_REPLY_AUX_DEFER:
                      case

AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:

Quoted 2 lines
                              retry_on_defer = true;

+ /* fall through */

I am a bit confusing here. Why a comment can avoid a compiler warning?

Quoted 5 lines

The kernel enables fall through warnings, so unless there is a comment mentioning that are are expecting to fall through here, we get a warning. The idea is to find missing breaks in switch code.

Alex

Got you. Thank you for your explanation.

Quoted 14 lines
Quoted 10 lines
Quoted 10 lines

case
AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:

                              if (++aux_defer_retries >=
AUX_MAX_DEFER_RETRIES) {
                                      goto fail;

--
2.23.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]

Quoted 9 lines

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.

Quoted 2 lines
Quoted 2 lines

freedesktop.org%2Fmailman%2Flistinfo%2Famd-

gfx&amp;data=02%7C01%7Czhan.liu%40amd.com%7C77d85a0275aa4c0a78

Quoted 1 line
Quoted 1 line

2f08d779cb9716%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6

Quoted 1 line
Quoted 1 line

37111788208702340&amp;sdata=3m%2FuNuNIgq82z%2BAeXJ9y7wn81kV%

Quoted 1 line
Quoted 1 line

2FiDt3AyC3CDiTRrc%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by
#4 lore raw
Quoted 48 lines · Zhan
Quoted 48 lines

-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: 2019/December/05, Thursday 5:13 PM
To: Liu, Zhan <[email protected]>
Cc: [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] drm/amdgpu/display: add fallthrough comment

Quoted 18 lines · Zhan
Quoted 18 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: 2019/December/05, Thursday 4:39 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/display: add fallthrough comment

To avoid a compiler warning.

---
 drivers/gpu/drm/amd/display/dc/dce/dce_aux.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines
Quoted 10 lines
drivers/gpu/drm/amd/display/dc/dce/dce_aux.c +0 -0
index 191b68b8163a..f1a5d2c6aa37 100644
@@ -645,6 +645,7 @@ bool dce_aux_transfer_with_retries(struct
 ddc_service *ddc,
                      case AUX_TRANSACTION_REPLY_AUX_DEFER:
                      case

AUX_TRANSACTION_REPLY_I2C_OVER_AUX_DEFER:

Quoted 2 lines
                              retry_on_defer = true;

+ /* fall through */

I am a bit confusing here. Why a comment can avoid a compiler warning?

The kernel enables fall through warnings, so unless there is a comment mentioning that are are expecting to fall through here, we get a warning. The idea is to find missing breaks in switch code.

Quoted 6 lines
Quoted 1 line

Alex

Got you. Thank you for your explanation.

Interesting. It's described at [1] (search for
-Wimplicit-fallthrough=3). Never knew that.

This is also

[1]
https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

Harry

Quoted 19 lines
Quoted 19 lines
Quoted 10 lines
Quoted 10 lines

case
AUX_TRANSACTION_REPLY_I2C_OVER_AUX_NACK:

                              if (++aux_defer_retries >=
AUX_MAX_DEFER_RETRIES) {
                                      goto fail;

--
2.23.0

Quoted 4 lines
Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]

https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.

Quoted 2 lines
Quoted 2 lines

freedesktop.org%2Fmailman%2Flistinfo%2Famd-

gfx&amp;data=02%7C01%7Czhan.liu%40amd.com%7C77d85a0275aa4c0a78

Quoted 1 line
Quoted 1 line
Quoted 9 lines
Quoted 4 lines

2f08d779cb9716%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C6

Quoted 1 line
Quoted 1 line

37111788208702340&amp;sdata=3m%2FuNuNIgq82z%2BAeXJ9y7wn81kV%

Quoted 1 line
Quoted 1 line

2FiDt3AyC3CDiTRrc%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx