watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
PATCH 1/1 watchdog: wdat_wdt: fix return value check in wdat_wdt_probe()
From: Wei Yongjun <[email protected]>
In case of error, the function devm_ioremap_resource() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().
--- drivers/watchdog/wdat_wdt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/watchdog/wdat_wdt.c +4 -3
@@ -351,16 +351,17 @@ static int wdat_wdt_probe(struct platform_device *pdev) res = &pdev->resource[i];if (resource_type (res) ==IORESOURCE_MEM ) { reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (reg)) +return PTR_ERR (reg); }else if (resource_type (res) ==IORESOURCE_IO ) { reg =devm_ioport_map (&pdev->dev, res->start,1 ); +if (!reg) +return -ENOMEM ; }else {dev_err (&pdev->dev,"Unsupported resource\n" );return -EINVAL ; } -if (!reg) -return -ENOMEM ; - regs[i] = reg; }
Quoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
devm_ioremap_resource()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>
Quoted 9 lines · Mika Westerberg
Quoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
devm_ioremap_resource()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>Acked-by Mika Westerberg <[email protected]>
Applied (with tags).
Thanks,
Rafael
Quoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
devm_ioremap_resource()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>
Quoted 33 lines
--- drivers/watchdog/wdat_wdt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/watchdog/wdat_wdt.c +4
-4@@ -351,16 +351,17 @@ static int wdat_wdt_probe(struct platform_device *pdev) res = &pdev->resource[i];if (resource_type (res) ==IORESOURCE_MEM ) { reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (reg)) +return PTR_ERR (reg); }else if (resource_type (res) ==IORESOURCE_IO ) { reg =devm_ioport_map (&pdev->dev, res->start,1 ); +if (!reg) +return -ENOMEM ; }else {dev_err (&pdev->dev,"Unsupported resource\n" );return -EINVAL ; } -if (!reg) -return -ENOMEM ; - regs[i] = reg; } --To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
In case of error, the function
devm_ioremap_resource()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>
Can you please CC your fixes to a mailing list, [email protected] at least if you can't find a more specific one?
They are much easier to handle then, to me at least.
Quoted 18 lines
--- drivers/watchdog/wdat_wdt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)drivers/watchdog/wdat_wdt.c +4
-0@@ -351,16 +351,17 @@ static int wdat_wdt_probe(struct platform_device *pdev) res = &pdev->resource[i];if (resource_type (res) ==IORESOURCE_MEM ) { reg =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (reg)) +return PTR_ERR (reg); }else if (resource_type (res) ==IORESOURCE_IO ) { reg =devm_ioport_map (&pdev->dev, res->start,1 ); +if (!reg) +return -ENOMEM ;
drivers/watchdog/wdat_wdt.c static int wdat_wdt_probe(struct platform_device *pdev) · line 366
Quoted 10 lines
drivers/watchdog/wdat_wdt.c +0
-3}else {dev_err (&pdev->dev,"Unsupported resource\n" );return -EINVAL ; } -if (!reg) -return -ENOMEM ; - regs[i] = reg; }
Thanks,
Rafael