From mboxrd@z Thu Jan 1 00:00:00 1970 From: der.herr@hofr.at (Nicholas Mc Guire) Date: Sat, 8 Oct 2016 10:40:37 +0000 Subject: if/else block default coding style question Message-ID: <20161008104037.GA493@osadl.at> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org Hi ! There are quite a few places (roughly 90) in the kernel where an if/else if/else block repeats the last "case" presumably as default e.g. drivers/net/wireless/realtek/rtlwifi/rtl8192c/dm_common.c if ((rtlpcipriv->bt_coexist.bt_service == BT_BUSY) && (rtlpcipriv->bt_coexist.bt_rssi_state & BT_RSSI_STATE_NORMAL_POWER)) { rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); } else if ((rtlpcipriv->bt_coexist.bt_service == BT_OTHER_ACTION) && (rtlpriv->mac80211.mode < WIRELESS_MODE_N_24G) && (rtlpcipriv->bt_coexist.bt_rssi_state & BT_RSSI_STATE_SPECIAL_LOW)) { rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, 0xa0); } else if (rtlpcipriv->bt_coexist.bt_service == BT_PAN) { rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte); } else { rtl_write_byte(rtlpriv, REG_GPIO_MUXCFG, tmp1byte); } with the last else if and else being identical. So the question is if this is accepted coding style (notably without a coment) or if things like this should be flagged. I personally find this irritating as (without a comment) it is hard to say if this is a trivial type -> missed case, or if this is intended as a default behavior. So - before starting to generate a series of patches - should stuff like this be flagged ? thx! hofrat