rtc: snvs: fix an incorrect check of return value
authorPan Bian <bianpan2016@163.com>
Sun, 23 Apr 2017 05:43:24 +0000 (13:43 +0800)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Thu, 4 May 2017 22:43:50 +0000 (00:43 +0200)
Function devm_regmap_init_mmio() returns an ERR_PTR on error. However,
in function snvs_rtc_probe() its return value is checked against NULL.
This patch fixes it by checking the return value with IS_ERR().

Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-snvs.c

index d51b07d..d8ef9e0 100644 (file)
@@ -258,7 +258,7 @@ static int snvs_rtc_probe(struct platform_device *pdev)
                of_property_read_u32(pdev->dev.of_node, "offset", &data->offset);
        }
 
-       if (!data->regmap) {
+       if (IS_ERR(data->regmap)) {
                dev_err(&pdev->dev, "Can't find snvs syscon\n");
                return -ENODEV;
        }