iwlegacy: no need to check return value of debugfs_create functions
PATCH 1/1 iwlegacy: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
--- .../net/wireless/intel/iwlegacy/3945-mac.c | 5 +-- .../net/wireless/intel/iwlegacy/4965-mac.c | 5 +-- drivers/net/wireless/intel/iwlegacy/common.h | 6 ++-- drivers/net/wireless/intel/iwlegacy/debug.c | 34 +++---------------- 4 files changed, 8 insertions(+), 42 deletions(-)
drivers/net/wireless/intel/iwlegacy/3945-mac.c +1 -4
@@ -3756,10 +3756,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err) goto out_remove_sysfs; - err =il_dbgfs_register (il,DRV_NAME ); -if (err) -IL_ERR ("failed to create debugfs files. Ignoring error: %d\n" , - err); +il_dbgfs_register (il,DRV_NAME );/* Start monitoring the killswitch */ queue_delayed_work (il->workqueue, &il->_3945.rfkill_poll,2 *HZ );
drivers/net/wireless/intel/iwlegacy/4965-mac.c +1 -4
@@ -4988,10 +4988,7 @@ il4965_ucode_callback(const struct firmware *ucode_raw, void *context)if (err) goto out_unbind; - err =il_dbgfs_register (il,DRV_NAME ); -if (err) -IL_ERR ("failed to create debugfs files. Ignoring error: %d\n" , - err); +il_dbgfs_register (il,DRV_NAME ); err =sysfs_create_group (&il->pci_dev->dev.kobj, &il_attribute_group);if (err) {
drivers/net/wireless/intel/iwlegacy/common.h +2 -4
@@ -2974,13 +2974,11 @@ il_print_hex_dump(struct il_priv *il, int level, const void *p, u32 len)#endif /* CONFIG_IWLEGACY_DEBUG */ #ifdef CONFIG_IWLEGACY_DEBUGFS -int il_dbgfs_register (struct il_priv *il,const char *name); +void il_dbgfs_register (struct il_priv *il,const char *name);void il_dbgfs_unregister (struct il_priv *il);#else -static inline int -il_dbgfs_register (struct il_priv *il,const char *name) +static inline void il_dbgfs_register (struct il_priv *il,const char *name) { -return 0 ; } static inline void
drivers/net/wireless/intel/iwlegacy/debug.c +4 -30
@@ -128,23 +128,12 @@ EXPORT_SYMBOL(il_update_stats);/* create and remove of files */ #define DEBUGFS_ADD_FILE (name, parent, mode) do { \ - if (!debugfs_create_file(#name, mode, parent, il, \ - &il_dbgfs_##name##_ops)) \ - goto err; \ + debugfs_create_file(#name, mode, parent, il, \ + &il_dbgfs_##name##_ops); \ } while (0)#define DEBUGFS_ADD_BOOL (name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_bool(#name, 0600, parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ -} while (0) - -#define DEBUGFS_ADD_X32 (name, parent, ptr) do { \ - struct dentry *__tmp; \ - __tmp = debugfs_create_x32(#name, 0600, parent, ptr); \ - if (IS_ERR(__tmp) || !__tmp) \ - goto err; \ + debugfs_create_bool(#name, 0600, parent, ptr); \ } while (0)/* file operation */
@@ -1341,27 +1330,18 @@ DEBUGFS_WRITE_FILE_OPS(wd_timeout);* Create the debugfs files and directories * */ -int +void il_dbgfs_register (struct il_priv *il,const char *name) {struct dentry *phyd = il->hw->wiphy->debugfsdir;struct dentry *dir_drv, *dir_data, *dir_rf, *dir_debug; dir_drv =debugfs_create_dir (name, phyd); -if (!dir_drv) -return -ENOMEM ; - il->debugfs_dir = dir_drv; dir_data =debugfs_create_dir ("data" , dir_drv); -if (!dir_data) - goto err; dir_rf =debugfs_create_dir ("rf" , dir_drv); -if (!dir_rf) - goto err; dir_debug =debugfs_create_dir ("debug" , dir_drv); -if (!dir_debug) - goto err;DEBUGFS_ADD_FILE (nvm, dir_data,0400 );DEBUGFS_ADD_FILE (sram, dir_data,0600 );
@@ -1399,12 +1379,6 @@ il_dbgfs_register(struct il_priv *il, const char *name)DEBUGFS_ADD_BOOL (disable_chain_noise, dir_rf, &il->disable_chain_noise_cal);DEBUGFS_ADD_BOOL (disable_tx_power, dir_rf, &il->disable_tx_power_cal); -return 0 ; - -err: -IL_ERR ("Can't create the debugfs directory\n" ); -il_dbgfs_unregister (il); -return -ENOMEM ; }EXPORT_SYMBOL (il_dbgfs_register);
Signature · 1 line
2.20.1
Quoted 8 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Cc Stanislaw Gruszka <[email protected]>Cc Kalle Valo <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 9 lines · Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this.
Cc Stanislaw Gruszka <[email protected]>Cc Kalle Valo <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Patch applied to wireless-drivers-next.git, thanks.
71ee1284d626 iwlegacy: no need to check return value of debugfs_create functions
Signature · 3 lines
https://patchwork.kernel.org/patch/10775803/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches