Skip to content

Commit

Permalink
phy: sunplus: Fix an IS_ERR() vs NULL bug in sp_usb_phy_probe
Browse files Browse the repository at this point in the history
The devm_ioremap() function returns NULL on error, it doesn't return
error pointers.

Fixes: 99d9ccd ("phy: usb: Add USB2.0 phy driver for Sunplus SP7021")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
Link: https://lore.kernel.org/r/20220911060053.123594-1-wupeng58@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
  • Loading branch information
Peng Wu authored and Vinod Koul committed Nov 4, 2022
1 parent 04948e7 commit 6e59419
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/phy/sunplus/phy-sunplus-usb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 6e59419

Please sign in to comment.