usb: phy: omap-usb2: fix devm_ioremap_resource error detection code
PATCH 1/1 usb: phy: omap-usb2: fix devm_ioremap_resource error detection code
devm_ioremap_resource returns an ERR_PTR value, not NULL, on failure.
A simplified version of the semantic match that finds this problem is as follows:
// <smpl>
@@
expression e,e1;
statement S;
@@
*e = devm_ioremap_resource(...);
if (!e1) S
// </smpl>
Signed-off-by Himangi Saraogi <[email protected]>
Acked-by Julia Lawall <[email protected]>
--- drivers/phy/phy-omap-usb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-omap-usb2.c +2 -2
@@ -233,8 +233,8 @@ static int omap_usb2_probe(struct platform_device *pdev)if (phy_data->flags &OMAP_USB2_CALIBRATE_FALSE_DISCONNECT ) { res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); phy->phy_base =devm_ioremap_resource (&pdev->dev, res); -if (!phy->phy_base) -return -ENOMEM ; +if (IS_ERR (phy->phy_base)) +return PTR_ERR (phy->phy_base); phy->flags |=OMAP_USB2_CALIBRATE_FALSE_DISCONNECT ; }
Signature · 1 line
1.9.1