Skip to contentSkip to conversation

phy: sunplus: Fix an IS_ERR() vs NULL bug in sp_usb_phy_probe

PATCH New Peng Wu 1 participant 1 message Nov 2, 2022

Subsystems (3)
lore
Share & tools
lore

Peng Wu

author
#0 lore raw

PATCH 1/1 phy: sunplus: Fix an IS_ERR() vs NULL bug in sp_usb_phy_probe

The devm_ioremap() function returns NULL on error, it doesn't return error pointers.

Fixes 99d9ccd97385 ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
---
 drivers/phy/sunplus/phy-sunplus-usb2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/sunplus/phy-sunplus-usb2.c +2 -2
index b932087c55b2..e827b79f6d49 100644
@@ -256,8 +256,8 @@ static int sp_usb_phy_probe(struct platform_device *pdev)
 	usbphy->moon4_res_mem = platform_get_resource_byname(pdev, IORESOURCE_MEM, "moon4");
 	usbphy->moon4_regs = devm_ioremap(&pdev->dev, usbphy->moon4_res_mem->start,
 					  resource_size(usbphy->moon4_res_mem));
-	if (IS_ERR(usbphy->moon4_regs))
-		return PTR_ERR(usbphy->moon4_regs);
+	if (!usbphy->moon4_regs)
+		return -ENOMEM;
 
 	usbphy->phy_clk = devm_clk_get(&pdev->dev, NULL);
 	if (IS_ERR(usbphy->phy_clk))
Signature · 1 line
2.17.1