Skip to content

Commit 6ee8a9a

Browse files
Jinjie Ruanvinodkoul
authored andcommitted
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: 134e6d2 ("phy: realtek: usb: Add driver for the Realtek SoC USB 2.0 PHY") Fixes: adda6e8 ("phy: realtek: usb: Add driver for the Realtek SoC USB 3.0 PHY") Signed-off-by: Jinjie Ruan <[email protected]> Suggested-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 426e05c commit 6ee8a9a

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

drivers/phy/realtek/phy-rtk-usb2.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,17 +853,11 @@ static inline void create_debug_files(struct rtk_phy *rtk_phy)
853853

854854
rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev),
855855
phy_debug_root);
856-
if (!rtk_phy->debug_dir)
857-
return;
858856

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);
862859

863860
return;
864-
865-
file_error:
866-
debugfs_remove_recursive(rtk_phy->debug_dir);
867861
}
868862

869863
static inline void remove_debug_files(struct rtk_phy *rtk_phy)

drivers/phy/realtek/phy-rtk-usb3.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,17 +416,11 @@ static inline void create_debug_files(struct rtk_phy *rtk_phy)
416416
return;
417417

418418
rtk_phy->debug_dir = debugfs_create_dir(dev_name(rtk_phy->dev), phy_debug_root);
419-
if (!rtk_phy->debug_dir)
420-
return;
421419

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);
425422

426423
return;
427-
428-
file_error:
429-
debugfs_remove_recursive(rtk_phy->debug_dir);
430424
}
431425

432426
static inline void remove_debug_files(struct rtk_phy *rtk_phy)

0 commit comments

Comments
 (0)