phy: eswin: Fix incorrect error check in probe()
PATCH 1/1 phy: eswin: Fix incorrect error check in probe()
devm_ioremap() returns NULL on failure, not an ERR_PTR. Using IS_ERR() to check the return value is incorrect.
Fix this by checking for NULL and returning -ENOMEM.
Fixes 67ee9ccaa34a ("phy: eswin: Create eswin directory and add EIC7700 SATA PHY driver")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Yulin Lu <[email protected]>
--- drivers/phy/eswin/phy-eic7700-sata.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/eswin/phy-eic7700-sata.c +2 -2
@@ -216,8 +216,8 @@ static int eic7700_sata_phy_probe(struct platform_device *pdev)return -ENOENT ; regs =devm_ioremap (dev, res->start,resource_size (res)); -if (IS_ERR (regs)) -return PTR_ERR (regs); +if (!regs) +return -ENOMEM ; sata_phy->regmap =devm_regmap_init_mmio (dev, regs, &eic7700_sata_phy_regmap_config);
Signature · 1 line
2.25.1
Quoted 6 lines · Yulin Lu
devm_ioremap()returns NULL on failure, not anERR_PTR. UsingIS_ERR()to check the return value is incorrect.Fix this by checking for NULL and returning
-ENOMEM.
Applied, thanks!
[1/1] phy: eswin: Fix incorrect error check in probe()
commit: c2cd08e8f150738515c8df415ad7ecfa3d38124a
Best regards,
Signature · 1 line
~Vinod