Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1427534AbdDWFp1 (ORCPT ); Sun, 23 Apr 2017 01:45:27 -0400 Received: from m50-132.163.com ([123.125.50.132]:56564 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1427519AbdDWFpU (ORCPT ); Sun, 23 Apr 2017 01:45:20 -0400 From: Pan Bian To: Alessandro Zummo , Alexandre Belloni Cc: rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org, Pan Bian Subject: [PATCH 1/1] rtc: snvs: fix an incorrect check of return value Date: Sun, 23 Apr 2017 13:43:24 +0800 Message-Id: <1492926204-9535-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 1.9.1 X-CM-TRANSID: DNGowABXr1P9PvxYuzoMAA--.170S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Gr45KFWUZw4kZF4rXw47Jwb_yoW3ZFX_u3 47WrZ7Wan5KF10qrn7XrWfuryfKF4F9Fs5ur10gas3uay7Ar48tayUZr4kXrs7W3yxKF9x tryxXF93Cr1xWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUbZmR5UUUUU== X-Originating-IP: [123.118.194.153] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/1tbiQADCclSISvIzjAAAsr Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 775 Lines: 25 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 --- drivers/rtc/rtc-snvs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-snvs.c b/drivers/rtc/rtc-snvs.c index d51b07d..d8ef9e0 100644 --- a/drivers/rtc/rtc-snvs.c +++ b/drivers/rtc/rtc-snvs.c @@ -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; } -- 1.9.1