From: Wei Yongjun Date: Fri, 17 Jun 2016 17:11:35 +0000 (+0000) Subject: watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=db6d2d0e6d24176f524359bff2f209f0c8425496;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git watchdog: pic32-wdt: Fix return value check in pic32_wdt_drv_probe() In case of error, the function devm_kzalloc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun Reviewed-by: Guenter Roeck Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/pic32-wdt.c b/drivers/watchdog/pic32-wdt.c index 6047aa89a4d3..2b7a2b22fcb2 100644 --- a/drivers/watchdog/pic32-wdt.c +++ b/drivers/watchdog/pic32-wdt.c @@ -174,8 +174,8 @@ static int pic32_wdt_drv_probe(struct platform_device *pdev) struct resource *mem; wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL); - if (IS_ERR(wdt)) - return PTR_ERR(wdt); + if (!wdt) + return -ENOMEM; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); wdt->regs = devm_ioremap_resource(&pdev->dev, mem);