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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:47:50 +0000 (19:47 +0200)
[ Upstream commit 758929005f06f954b7e1c87a1c9fdb44157b228f ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rtc/rtc-snvs.c

index 0f11c2a228e35a02033e1b64dcddc6f5599927cd..a753ef9c14595ca61e234ab2b8b4ff633401c4b3 100644 (file)
@@ -257,7 +257,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;
        }