Re: [PATCH v2] net: ll_temac: Use one return statement instead of two

From: Joe Perches
Date: Mon May 11 2015 - 10:43:01 EST


On Mon, 2015-05-11 at 16:05 +0200, Michal Simek wrote:
> Use one return statement instead of two to simplify the code.
> Both are returning the same value.

trivia and FYI:

I think there are about 100 of these in kernel tree
and I'm not going to submit patches.

$ grep-2.5.4 -rP --include=*.[ch] -n "^([\t]+)\treturn[ \t]+([A-Za-z0-9\_\>\(\)\.\>\[\]\-]+);\n(\1}\n)?\1return[ \t]+\2;" * | \
grep -P "^[\w\/\.]+:\d+:"
arch/x86/kvm/emulate.c:2122: return rc;
arch/um/kernel/exitcode.c:75: return 0;
arch/um/drivers/mconsole_kern.c:784: return 0;
arch/powerpc/include/asm/floppy.h:84: return IRQ_HANDLED;
drivers/gpu/drm/via/via_video.c:90: return 0;
drivers/gpu/drm/via/via_verifier.c:514: return 2;
drivers/gpu/drm/omapdrm/omap_fb.c:375: return fb;
drivers/gpu/drm/radeon/evergreen_cs.c:312: return -EINVAL;
drivers/gpu/drm/radeon/ni.c:2161: return r;
drivers/isdn/capi/capidrv.c:1682: return -EINVAL;
drivers/isdn/hisax/saphir.c:237: return (0);
drivers/isdn/hisax/teles3.c:249: return (0);
drivers/isdn/hisax/hfc_pci.c:1628: return (0);
drivers/isdn/hisax/ix1_micro.c:206: return (0);
drivers/isdn/hisax/avm_a1p.c:211: return 0;
drivers/isdn/hisax/w6692.c:987: return (0);
drivers/isdn/hisax/asuscom.c:292: return (0);
drivers/isdn/hisax/avm_a1.c:175: return (0);
drivers/isdn/hisax/hfcscard.c:133: return (0);
drivers/isdn/hisax/teleint.c:257: return (0);
drivers/isdn/hisax/hfc_sx.c:1379: return (0);
drivers/isdn/hisax/teles0.c:261: return (0);
drivers/isdn/hisax/mic.c:185: return (0);
drivers/isdn/hisax/nj_u.c:126: return (0);
drivers/isdn/hisax/bkm_a4t.c:251: return (0);
drivers/isdn/hisax/avm_pci.c:716: return (0);
drivers/isdn/hisax/bkm_a8.c:253: return (0);
drivers/isdn/hisax/sportster.c:181: return (0);
drivers/isdn/hisax/niccy.c:220: return 0;
drivers/isdn/hisax/telespci.c:281: return (0);
drivers/isdn/hisax/isurf.c:170: return (0);
drivers/isdn/hisax/gazel.c:427: return (0);
drivers/isdn/hisax/nj_s.c:146: return (0);
drivers/isdn/i4l/isdn_v110.c:613: return 0;
drivers/isdn/hardware/avm/b1.c:634: return IRQ_HANDLED;
drivers/staging/lustre/lustre/osc/osc_request.c:2429: return rc;
drivers/staging/dgap/dgap.c:421: return 0;
drivers/staging/comedi/drivers/ni_mio_common.c:4997: return 0;
drivers/staging/comedi/drivers/usbduxsigma.c:1245: return -EINVAL;
drivers/staging/comedi/drivers/cb_pcidas64.c:1961: return -EINVAL;
drivers/staging/comedi/drivers/usbdux.c:1384: return -EINVAL;
drivers/hid/wacom_wac.c:1063: return 0;
drivers/crypto/qat/qat_dh895xcc/adf_isr.c:144: return ret;
drivers/crypto/qat/qat_dh895xcc/adf_dh895xcc_hw_data.c:135: return DEV_SKU_UNKNOWN;
drivers/parisc/led.c:168: return 0;
drivers/block/drbd/drbd_receiver.c:3457: return tfm;
drivers/iio/light/tcs3472.c:180: return -EINVAL;
drivers/misc/genwqe/card_base.c:1335: return 0;
drivers/mfd/tps80031.c:267: return ret;
drivers/mfd/tps80031.c:307: return ret;
drivers/mfd/palmas.c:374: return ret;
drivers/char/tpm/tpm_infineon.c:308: return -EIO;
drivers/scsi/wd7000.c:1558: return FAILED;
drivers/scsi/scsi_error.c:720: return FAILED;
drivers/scsi/scsi_error.c:1920: return FAILED;
drivers/scsi/be2iscsi/be_mgmt.c:1414: return rc;
drivers/scsi/initio.c:2480: return host->phase;
drivers/scsi/qla2xxx/qla_mr.c:692: return str;
drivers/scsi/bfa/bfa_fcbuild.c:208: return FC_PARSE_OK;
drivers/scsi/arcmsr/arcmsr_hba.c:3736: return rtnval;
drivers/scsi/BusLogic.c:3317: return SUCCESS;
drivers/net/ethernet/xilinx/ll_temac_main.c:693: return NETDEV_TX_BUSY;
drivers/net/ethernet/qlogic/qlge/qlge_main.c:3251: return err;
drivers/net/ethernet/qlogic/qlge/qlge_main.c:3295: return err;
drivers/net/ethernet/qlogic/qlge/qlge_main.c:3638: return status;
drivers/net/ethernet/intel/ixgbe/ixgbe_phy.c:1492: return 0;
drivers/net/wan/x25_asy.c:350: return NETDEV_TX_OK;
drivers/net/wireless/rtlwifi/rtl8192cu/mac.c:227: return rst;
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c:1176: return err;
drivers/net/plip/plip.c:739: return OK;
drivers/net/plip/plip.c:853: return OK;
drivers/net/caif/caif_serial.c:411: return result;
drivers/spi/spi.c:1057: return ret;
drivers/usb/gadget/function/f_loopback.c:560: return ret;
drivers/infiniband/ulp/isert/ib_isert.c:2143: return ret;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:1808: return status;
drivers/infiniband/hw/ocrdma/ocrdma_hw.c:151: return IB_QPS_ERR;
drivers/infiniband/hw/ocrdma/ocrdma_hw.c:170: return OCRDMA_QPS_ERR;
drivers/infiniband/hw/cxgb4/iw_cxgb4.h:618: return IB_QPS_ERR;
drivers/infiniband/hw/mlx5/qp.c:1547: return 0;
drivers/media/pci/smipcie/smipcie.c:261: return ret;
drivers/media/i2c/tw2804.c:196: return 0;
drivers/video/fbdev/68328fb.c:355: return 0;
drivers/video/fbdev/vfb.c:378: return 0;
fs/namespace.c:1935: return mp;
kernel/auditsc.c:425: return 0;
kernel/trace/trace_uprobe.c:1192: return 0;
net/sctp/outqueue.c:150: return 0;
net/caif/cfctrl.c:112: return false;
net/ipv4/netfilter/nf_nat_snmp_basic.c:1299: return ret;
net/tipc/server.c:612: return ret;
sound/pci/riptide/riptide.c:2003: return err;
sound/pci/rme9652/hdsp.c:2711: return 0;
sound/core/compress_offload.c:879: return ret;
sound/core/seq/oss/seq_oss_timer.c:274: return 0;
sound/oss/sb_midi.c:100: return 1;
sound/soc/codecs/max98925.c:120: return 0;
tools/perf/util/config.c:391: return 0;
tools/perf/util/alias.c:13: return 0;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/