Re: [PATCH] scsi: arcmsr: Remove the superfluous break

From: Joe Perches
Date: Fri Sep 18 2020 - 15:07:55 EST


On Fri, 2020-09-18 at 11:17 -0600, Jens Axboe wrote:
> On 9/18/20 11:13 AM, Joe Perches wrote:
> > On Fri, 2020-09-18 at 09:56 -0500, Gustavo A. R. Silva wrote:
> > > On Fri, Sep 18, 2020 at 05:32:30PM +0800, Jing Xiangfeng wrote:
> > > > Remove the superfluous break, as there is a 'return' before it.
> > > >
> > >
> > > Apparently, the change is correct. Please, just add a proper Fixes tag by
> > > yourself this time.
> >
> > There's no need for a "Fixes:" here, it's purely cosmetic.
> >
> > btw:
> >
> > There are at least 150 instances of
> > return foo(...);
> > break;
> > still in the kernel tree:
>
> A lot of these are false positives, since they follow a pattern of:
>
> if (some_condition)
> return func();
> break;

Ah, right. Thanks.

Refining the test a bit to make sure the number of tabs before the
return and before the break are the same appears to show 42 instances.

$ grep-2.5.4 -rP --include=*.[ch] -n "^([\t]+)\breturn\s+\w+\s*\([^\)]+\)\s*;[ \t]*\n\1break\s*;\s*(case\s+\w+|default)\s*:" * | grep return | wc -l
42

(the line numbering seems screwed up below,
but the instances listed seem right)

$ grep-2.5.4 -rP --include=*.[ch] -n "^([\t]+)\breturn\s+\w+\s*\([^\)]+\)\s*;[ \t]*\n\1break\s*;\s*(case\s+\w+|default)\s*:" * | grep return
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c:275: return pci_isa_read_bar(0);
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c:276: return pci_isa_read_bar(1);
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c:277: return pci_isa_read_bar(2);
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c:280: return pci_isa_read_bar(4);
arch/mips/loongson2ef/common/cs5536/cs5536_isa.c:281: return pci_isa_read_bar(5);
arch/x86/kvm/emulate.c:1863: return segmented_write(ctxt,
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2091: return __rtl8821ae_phy_config_with_headerfile(hw,
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2092: return __rtl8821ae_phy_config_with_headerfile(hw,
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/phy.c:2114: return __rtl8821ae_phy_config_with_headerfile(hw,
drivers/net/wireless/marvell/mwifiex/cfg80211.c:1210: return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
drivers/net/wireless/marvell/mwifiex/cfg80211.c:1246: return mwifiex_change_vif_to_sta_adhoc(dev, curr_iftype,
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c:1200: return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
drivers/net/hyperv/netvsc.c:1275: return netvsc_receive(ndev, net_device, nvchan,
drivers/media/dvb-frontends/si21xx.c:466: return si21_writereg(state, LNB_CTRL_REG_1, val | 0x40);
drivers/media/usb/ttusb-dec/ttusb_dec.c:1104: return ttusb_dec_start_ts_feed(dvbdmxfeed);
drivers/media/usb/ttusb-dec/ttusb_dec.c:1105: return ttusb_dec_start_sec_feed(dvbdmxfeed);
drivers/media/usb/ttusb-dec/ttusb_dec.c:1153: return ttusb_dec_stop_ts_feed(dvbdmxfeed);
drivers/scsi/bfa/bfa_ioc.h:1000: return bfi_image_cb_get_chunk(off);
drivers/scsi/bfa/bfa_ioc.h:1001: return bfi_image_ct_get_chunk(off);
drivers/scsi/bfa/bfa_ioc.h:1002: return bfi_image_ct2_get_chunk(off);
drivers/scsi/be2iscsi/be_mgmt.c:1245: return snprintf(buf, PAGE_SIZE,
drivers/scsi/be2iscsi/be_mgmt.c:1247: return snprintf(buf, PAGE_SIZE, "BE3-R Adapter Family\n");
drivers/scsi/be2iscsi/be_mgmt.c:1248: return snprintf(buf, PAGE_SIZE, "Skyhawk-R Adapter Family\n");
drivers/scsi/arcmsr/arcmsr_hba.c:2701: return arcmsr_hbaA_handle_isr(acb);
drivers/scsi/arcmsr/arcmsr_hba.c:2702: return arcmsr_hbaB_handle_isr(acb);
drivers/iio/adc/meson_saradc.c:594: return meson_sar_adc_get_sample(indio_dev, chan, NO_AVERAGING,
drivers/iio/adc/meson_saradc.c:595: return meson_sar_adc_get_sample(indio_dev, chan,
drivers/s390/char/tape_34xx.c:653: return tape_34xx_done(request);
drivers/s390/char/tape_3590.c:945: return tape_3590_erp_failed(device, request, irb, -EIO);
drivers/nfc/st21nfca/core.c:792: return nfc_hci_send_cmd_async(hdev, target->hci_reader_gate,
drivers/gpu/drm/mgag200/mgag200_mode.c:796: return mga_g200se_set_plls(mdev, clock);
drivers/gpu/drm/mgag200/mgag200_mode.c:798: return mga_g200wb_set_plls(mdev, clock);
drivers/gpu/drm/mgag200/mgag200_mode.c:799: return mga_g200ev_set_plls(mdev, clock);
drivers/gpu/drm/mgag200/mgag200_mode.c:801: return mga_g200eh_set_plls(mdev, clock);
sound/soc/intel/skylake/skl-pcm.c:504: return skl_run_pipe(skl, mconfig->pipe);
sound/oss/dmasound/dmasound_core.c:1005: return IOCTL_OUT(arg, fmt);
sound/oss/dmasound/dmasound_core.c:1020: return IOCTL_OUT(arg, size);
sound/oss/dmasound/dmasound_core.c:1121: return IOCTL_OUT(arg, data);
tools/perf/ui/stdio/hist.c:392: return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
tools/perf/ui/stdio/hist.c:393: return callchain__fprintf_graph(fp, &he->sorted_chain, total_samples,
tools/perf/ui/stdio/hist.c:394: return callchain__fprintf_flat(fp, &he->sorted_chain, total_samples);
tools/perf/ui/stdio/hist.c:395: return callchain__fprintf_folded(fp, &he->sorted_chain, total_samples);