Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: realtek: usb: Drop unnecessary error check for debugfs_create_dir()

Both debugfs_create_dir() and debugfs_create_file() return ERR_PTR
and never return NULL.

As Greg suggested, this patch removes the error checking for
debugfs_create_dir in phy-rtk-usb2.c and phy-rtk-usb3.c. This is because
the DebugFS kernel API is developed in a way that the caller can safely
ignore the errors that occur during the creation of DebugFS nodes. The
debugfs APIs have a IS_ERR() judge in start_creating() which can handle it
gracefully. So these checks are unnecessary.

Fixes: 134e6d25f6bd ("phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY")
Fixes: adda6e82a7de ("phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20230901075231.1368947-1-ruanjinjie@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Jinjie Ruan and committed by
Vinod Koul
6ee8a9a7 426e05ce

+4 -16
+2 -8
drivers/phy/realtek/phy-rtk-usb2.c
··· 853 853 854 854 rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev), 855 855 phy_debug_root); 856 - if (!rtk_phy->debug_dir) 857 - return; 858 856 859 - if (!debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy, 860 - &rtk_usb2_parameter_fops)) 861 - goto file_error; 857 + debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy, 858 + &rtk_usb2_parameter_fops); 862 859 863 860 return; 864 - 865 - file_error: 866 - debugfs_remove_recursive(rtk_phy->debug_dir); 867 861 } 868 862 869 863 static inline void remove_debug_files(struct rtk_phy *rtk_phy)
+2 -8
drivers/phy/realtek/phy-rtk-usb3.c
··· 416 416 return; 417 417 418 418 rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev), phy_debug_root); 419 - if (!rtk_phy->debug_dir) 420 - return; 421 419 422 - if (!debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy, 423 - &rtk_usb3_parameter_fops)) 424 - goto file_error; 420 + debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy, 421 + &rtk_usb3_parameter_fops); 425 422 426 423 return; 427 - 428 - file_error: 429 - debugfs_remove_recursive(rtk_phy->debug_dir); 430 424 } 431 425 432 426 static inline void remove_debug_files(struct rtk_phy *rtk_phy)