[PATCH -next] phy: realtek: usb: Drop unnecessary error check for debugfs_create_dir
Ruan Jinjie
ruanjinjie at huawei.com
Thu Aug 3 18:17:51 PDT 2023
Ping.
On 2023/7/28 14:27, Ruan Jinjie wrote:
> 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_create_dir()
> does not return NULL but an ERR_PTR after an error.
>
> 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.
>
> Signed-off-by: Ruan Jinjie <ruanjinjie at huawei.com>
> ---
> drivers/phy/realtek/phy-rtk-usb2.c | 2 --
> drivers/phy/realtek/phy-rtk-usb3.c | 2 --
> 2 files changed, 4 deletions(-)
>
> diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c
> index ed47a1ce5d9c..715cd9480347 100644
> --- a/drivers/phy/realtek/phy-rtk-usb2.c
> +++ b/drivers/phy/realtek/phy-rtk-usb2.c
> @@ -853,8 +853,6 @@ static inline void create_debug_files(struct rtk_phy *rtk_phy)
>
> rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev),
> phy_debug_root);
> - if (!rtk_phy->debug_dir)
> - return;
>
> if (!debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy,
> &rtk_usb2_parameter_fops))
> diff --git a/drivers/phy/realtek/phy-rtk-usb3.c b/drivers/phy/realtek/phy-rtk-usb3.c
> index 6050f1ef4f6b..6d726926607a 100644
> --- a/drivers/phy/realtek/phy-rtk-usb3.c
> +++ b/drivers/phy/realtek/phy-rtk-usb3.c
> @@ -416,8 +416,6 @@ static inline void create_debug_files(struct rtk_phy *rtk_phy)
> return;
>
> rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev), phy_debug_root);
> - if (!rtk_phy->debug_dir)
> - return;
>
> if (!debugfs_create_file("parameter", 0444, rtk_phy->debug_dir, rtk_phy,
> &rtk_usb3_parameter_fops))
More information about the linux-phy
mailing list