Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0C9EC433F5 for ; Tue, 21 Dec 2021 11:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236976AbhLULPA (ORCPT ); Tue, 21 Dec 2021 06:15:00 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:29274 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236868AbhLULO7 (ORCPT ); Tue, 21 Dec 2021 06:14:59 -0500 Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JJDPR2g0FzbjYG; Tue, 21 Dec 2021 19:14:35 +0800 (CST) Received: from dggpeml500017.china.huawei.com (7.185.36.243) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 21 Dec 2021 19:14:58 +0800 Received: from huawei.com (10.175.103.91) by dggpeml500017.china.huawei.com (7.185.36.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Tue, 21 Dec 2021 19:14:57 +0800 From: Yang Yingliang To: , CC: , , Subject: [PATCH -next] rtc: gamecube: Fix return value check in gamecube_rtc_probe() Date: Tue, 21 Dec 2021 19:20:59 +0800 Message-ID: <20211221112059.305682-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpeml500017.china.huawei.com (7.185.36.243) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of error, the devm_kzalloc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/rtc/rtc-gamecube.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-gamecube.c b/drivers/rtc/rtc-gamecube.c index 98128746171e..f717b36f4738 100644 --- a/drivers/rtc/rtc-gamecube.c +++ b/drivers/rtc/rtc-gamecube.c @@ -319,8 +319,8 @@ static int gamecube_rtc_probe(struct platform_device *pdev) int ret; d = devm_kzalloc(dev, sizeof(struct priv), GFP_KERNEL); - if (IS_ERR(d)) - return PTR_ERR(d); + if (!d) + return -ENOMEM; d->iob = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(d->iob)) -- 2.25.1