Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy: Fix ptr_ret.cocci warnings

Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR.

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>

authored by

Vivek Gautam and committed by
Kishon Vijay Abraham I
045ef311 0e65ba28

+4 -16
+2 -8
drivers/phy/phy-ti-pipe3.c
··· 537 537 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 538 538 "pll_ctrl"); 539 539 phy->pll_ctrl_base = devm_ioremap_resource(dev, res); 540 - if (IS_ERR(phy->pll_ctrl_base)) 541 - return PTR_ERR(phy->pll_ctrl_base); 542 - 543 - return 0; 540 + return PTR_ERR_OR_ZERO(phy->pll_ctrl_base); 544 541 } 545 542 546 543 static int ti_pipe3_probe(struct platform_device *pdev) ··· 589 592 ti_pipe3_power_off(generic_phy); 590 593 591 594 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 592 - if (IS_ERR(phy_provider)) 593 - return PTR_ERR(phy_provider); 594 - 595 - return 0; 595 + return PTR_ERR_OR_ZERO(phy_provider); 596 596 } 597 597 598 598 static int ti_pipe3_remove(struct platform_device *pdev)
+2 -8
drivers/phy/tegra/xusb.c
··· 561 561 usb2->internal = of_property_read_bool(np, "nvidia,internal"); 562 562 563 563 usb2->supply = devm_regulator_get(&port->dev, "vbus"); 564 - if (IS_ERR(usb2->supply)) 565 - return PTR_ERR(usb2->supply); 566 - 567 - return 0; 564 + return PTR_ERR_OR_ZERO(usb2->supply); 568 565 } 569 566 570 567 static int tegra_xusb_add_usb2_port(struct tegra_xusb_padctl *padctl, ··· 728 731 usb3->internal = of_property_read_bool(np, "nvidia,internal"); 729 732 730 733 usb3->supply = devm_regulator_get(&port->dev, "vbus"); 731 - if (IS_ERR(usb3->supply)) 732 - return PTR_ERR(usb3->supply); 733 - 734 - return 0; 734 + return PTR_ERR_OR_ZERO(usb3->supply); 735 735 } 736 736 737 737 static int tegra_xusb_add_usb3_port(struct tegra_xusb_padctl *padctl,