Skip to content

Commit b4b52b8

Browse files
committed
Merge tag 'Wimplicit-fallthrough-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux
Pull Wimplicit-fallthrough updates from Gustavo A. R. Silva: "Mark switch cases where we are expecting to fall through. This is part of the ongoing efforts to enable -Wimplicit-fallthrough. Most of them have been baking in linux-next for a whole development cycle. And with Stephen Rothwell's help, we've had linux-next nag-emails going out for newly introduced code that triggers -Wimplicit-fallthrough to avoid gaining more of these cases while we work to remove the ones that are already present. We are getting close to completing this work. Currently, there are only 32 of 2311 of these cases left to be addressed in linux-next. I'm auditing every case; I take a look into the code and analyze it in order to determine if I'm dealing with an actual bug or a false positive, as explained here: https://lore.kernel.org/lkml/c2fad584-1705-a5f2-d63c-824e9b96cf50@embeddedor.com/ While working on this, I've found and fixed the several missing break/return bugs, some of them introduced more than 5 years ago. Once this work is finished, we'll be able to universally enable "-Wimplicit-fallthrough" to avoid any of these kinds of bugs from entering the kernel again" * tag 'Wimplicit-fallthrough-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux: (27 commits) memstick: mark expected switch fall-throughs drm/nouveau/nvkm: mark expected switch fall-throughs NFC: st21nfca: Fix fall-through warnings NFC: pn533: mark expected switch fall-throughs block: Mark expected switch fall-throughs ASN.1: mark expected switch fall-through lib/cmdline.c: mark expected switch fall-throughs lib: zstd: Mark expected switch fall-throughs scsi: sym53c8xx_2: sym_nvram: Mark expected switch fall-through scsi: sym53c8xx_2: sym_hipd: mark expected switch fall-throughs scsi: ppa: mark expected switch fall-through scsi: osst: mark expected switch fall-throughs scsi: lpfc: lpfc_scsi: Mark expected switch fall-throughs scsi: lpfc: lpfc_nvme: Mark expected switch fall-through scsi: lpfc: lpfc_nportdisc: Mark expected switch fall-through scsi: lpfc: lpfc_hbadisc: Mark expected switch fall-throughs scsi: lpfc: lpfc_els: Mark expected switch fall-throughs scsi: lpfc: lpfc_ct: Mark expected switch fall-throughs scsi: imm: mark expected switch fall-throughs scsi: csiostor: csio_wr: mark expected switch fall-through ...
2 parents 2d60d96 + ccaa751 commit b4b52b8

66 files changed

Lines changed: 216 additions & 68 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/block/drbd/drbd_int.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,7 @@ static inline void __drbd_chk_io_error_(struct drbd_device *device,
17781778
_drbd_set_state(_NS(device, disk, D_INCONSISTENT), CS_HARD, NULL);
17791779
break;
17801780
}
1781-
/* NOTE fall through for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
1781+
/* fall through - for DRBD_META_IO_ERROR or DRBD_FORCE_DETACH */
17821782
case EP_DETACH:
17831783
case EP_CALL_HELPER:
17841784
/* Remember whether we saw a READ or WRITE error.

‎drivers/block/drbd/drbd_receiver.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3094,7 +3094,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
30943094
rv = 1;
30953095
break;
30963096
}
3097-
/* Else fall through to one of the other strategies... */
3097+
/* Else fall through - to one of the other strategies... */
30983098
case ASB_DISCARD_OLDER_PRI:
30993099
if (self == 0 && peer == 1) {
31003100
rv = 1;
@@ -3119,7 +3119,7 @@ static int drbd_asb_recover_0p(struct drbd_peer_device *peer_device) __must_hold
31193119
}
31203120
if (after_sb_0p == ASB_DISCARD_ZERO_CHG)
31213121
break;
3122-
/* else: fall through */
3122+
/* else, fall through */
31233123
case ASB_DISCARD_LEAST_CHG:
31243124
if (ch_self < ch_peer)
31253125
rv = -1;

‎drivers/block/drbd/drbd_req.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
866866
} /* else: FIXME can this happen? */
867867
break;
868868
}
869-
/* else, fall through to BARRIER_ACKED */
869+
/* else, fall through - to BARRIER_ACKED */
870870

871871
case BARRIER_ACKED:
872872
/* barrier ack for READ requests does not make sense */

‎drivers/block/rsxx/core.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ static void card_state_change(struct rsxx_cardinfo *card,
439439
* Fall through so the DMA devices can be attached and
440440
* the user can attempt to pull off their data.
441441
*/
442+
/* fall through */
442443
case CARD_STATE_GOOD:
443444
st = rsxx_get_card_size8(card, &card->size8);
444445
if (st)

‎drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmi.c‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,55 @@ void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
2323
*/
2424
case 17:
2525
subpack1_high = (raw_frame[16] << 16);
26+
/* fall through */
2627
case 16:
2728
subpack1_high |= (raw_frame[15] << 8);
29+
/* fall through */
2830
case 15:
2931
subpack1_high |= raw_frame[14];
32+
/* fall through */
3033
case 14:
3134
subpack1_low = (raw_frame[13] << 24);
35+
/* fall through */
3236
case 13:
3337
subpack1_low |= (raw_frame[12] << 16);
38+
/* fall through */
3439
case 12:
3540
subpack1_low |= (raw_frame[11] << 8);
41+
/* fall through */
3642
case 11:
3743
subpack1_low |= raw_frame[10];
44+
/* fall through */
3845
case 10:
3946
subpack0_high = (raw_frame[9] << 16);
47+
/* fall through */
4048
case 9:
4149
subpack0_high |= (raw_frame[8] << 8);
50+
/* fall through */
4251
case 8:
4352
subpack0_high |= raw_frame[7];
53+
/* fall through */
4454
case 7:
4555
subpack0_low = (raw_frame[6] << 24);
56+
/* fall through */
4657
case 6:
4758
subpack0_low |= (raw_frame[5] << 16);
59+
/* fall through */
4860
case 5:
4961
subpack0_low |= (raw_frame[4] << 8);
62+
/* fall through */
5063
case 4:
5164
subpack0_low |= raw_frame[3];
65+
/* fall through */
5266
case 3:
5367
header = (raw_frame[2] << 16);
68+
/* fall through */
5469
case 2:
5570
header |= (raw_frame[1] << 8);
71+
/* fall through */
5672
case 1:
5773
header |= raw_frame[0];
74+
/* fall through */
5875
case 0:
5976
break;
6077
}

‎drivers/gpu/drm/nouveau/nvkm/engine/dma/usernv04.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ nv04_dmaobj_new(struct nvkm_dma *dma, const struct nvkm_oclass *oclass,
122122
break;
123123
case NV_MEM_ACCESS_WO:
124124
dmaobj->flags0 |= 0x00008000;
125+
/* fall through */
125126
case NV_MEM_ACCESS_RW:
126127
dmaobj->flags2 |= 0x00000002;
127128
break;

‎drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ nv04_fifo_swmthd(struct nvkm_device *device, u32 chid, u32 addr, u32 data)
117117
switch (mthd) {
118118
case 0x0000 ... 0x0000: /* subchannel's engine -> software */
119119
nvkm_wr32(device, 0x003280, (engine &= ~mask));
120+
/* fall through */
120121
case 0x0180 ... 0x01fc: /* handle -> instance */
121122
data = nvkm_rd32(device, 0x003258) & 0x0000ffff;
123+
/* fall through */
122124
case 0x0100 ... 0x017c:
123125
case 0x0200 ... 0x1ffc: /* pass method down to sw */
124126
if (!(engine & mask) && sw)

‎drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv40.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ nv40_fifo_init(struct nvkm_fifo *base)
8181
case 0x49:
8282
case 0x4b:
8383
nvkm_wr32(device, 0x002230, 0x00000001);
84+
/* fall through */
8485
case 0x40:
8586
case 0x41:
8687
case 0x42:

‎drivers/gpu/drm/nouveau/nvkm/subdev/bios/perf.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ nvbios_perfEp(struct nvkm_bios *bios, int idx,
135135
break;
136136
case 0x30:
137137
info->script = nvbios_rd16(bios, perf + 0x02);
138+
/* fall through */
138139
case 0x35:
139140
info->fanspeed = nvbios_rd08(bios, perf + 0x06);
140141
info->voltage = nvbios_rd08(bios, perf + 0x07);

‎drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ pll_map(struct nvkm_bios *bios)
134134
device->chipset == 0xaa ||
135135
device->chipset == 0xac)
136136
return g84_pll_mapping;
137+
/* fall through */
137138
default:
138139
return NULL;
139140
}

0 commit comments

Comments
 (0)