diff mbox series

[net] Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register"

Message ID 20220103193453.1214961-1-f.fainelli@gmail.com (mailing list archive)
State Accepted
Commit 065e1ae02fbe5f56f4aa118414d45fc30647acd4
Delegated to: Netdev Maintainers
Headers show
Series [net] Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register" | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Florian Fainelli Jan. 3, 2022, 7:34 p.m. UTC
This reverts commit b45396afa4177f2b1ddfeff7185da733fade1dc3 ("net: phy:
fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register")
since it prevents any system that uses a fixed PHY without a GPIO
descriptor from properly working:

[    5.971952] brcm-systemport 9300000.ethernet: failed to register fixed PHY
[    5.978854] brcm-systemport: probe of 9300000.ethernet failed with error -22
[    5.986047] brcm-systemport 9400000.ethernet: failed to register fixed PHY
[    5.992947] brcm-systemport: probe of 9400000.ethernet failed with error -22

Fixes: b45396afa417 ("net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/phy/fixed_phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Andrew Lunn Jan. 3, 2022, 8:16 p.m. UTC | #1
On Mon, Jan 03, 2022 at 11:34:52AM -0800, Florian Fainelli wrote:
> This reverts commit b45396afa4177f2b1ddfeff7185da733fade1dc3 ("net: phy:
> fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register")
> since it prevents any system that uses a fixed PHY without a GPIO
> descriptor from properly working:
> 
> [    5.971952] brcm-systemport 9300000.ethernet: failed to register fixed PHY
> [    5.978854] brcm-systemport: probe of 9300000.ethernet failed with error -22
> [    5.986047] brcm-systemport 9400000.ethernet: failed to register fixed PHY
> [    5.992947] brcm-systemport: probe of 9400000.ethernet failed with error -22
> 
> Fixes: b45396afa417 ("net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

I was hoping the original author would fixup the breakage, but it has
been a couple of days now....

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
patchwork-bot+netdevbpf@kernel.org Jan. 4, 2022, 3:10 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  3 Jan 2022 11:34:52 -0800 you wrote:
> This reverts commit b45396afa4177f2b1ddfeff7185da733fade1dc3 ("net: phy:
> fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register")
> since it prevents any system that uses a fixed PHY without a GPIO
> descriptor from properly working:
> 
> [    5.971952] brcm-systemport 9300000.ethernet: failed to register fixed PHY
> [    5.978854] brcm-systemport: probe of 9300000.ethernet failed with error -22
> [    5.986047] brcm-systemport 9400000.ethernet: failed to register fixed PHY
> [    5.992947] brcm-systemport: probe of 9400000.ethernet failed with error -22
> 
> [...]

Here is the summary with links:
  - [net] Revert "net: phy: fixed_phy: Fix NULL vs IS_ERR() checking in __fixed_phy_register"
    https://git.kernel.org/netdev/net/c/065e1ae02fbe

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c
index a0c256bd5441..c65fb5f5d2dc 100644
--- a/drivers/net/phy/fixed_phy.c
+++ b/drivers/net/phy/fixed_phy.c
@@ -239,8 +239,8 @@  static struct phy_device *__fixed_phy_register(unsigned int irq,
 	/* Check if we have a GPIO associated with this fixed phy */
 	if (!gpiod) {
 		gpiod = fixed_phy_get_gpiod(np);
-		if (!gpiod)
-			return ERR_PTR(-EINVAL);
+		if (IS_ERR(gpiod))
+			return ERR_CAST(gpiod);
 	}
 
 	/* Get the next available PHY address, up to PHY_MAX_ADDR */