From mboxrd@z Thu Jan 1 00:00:00 1970 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 D2217C433FE for ; Sun, 30 Jan 2022 00:58:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353614AbiA3A66 (ORCPT ); Sat, 29 Jan 2022 19:58:58 -0500 Received: from szxga02-in.huawei.com ([45.249.212.188]:17831 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233625AbiA3A66 (ORCPT ); Sat, 29 Jan 2022 19:58:58 -0500 Received: from canpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JmXq118Khz9sPH; Sun, 30 Jan 2022 08:57:33 +0800 (CST) Received: from [10.174.178.165] (10.174.178.165) by canpemm500009.china.huawei.com (7.192.105.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sun, 30 Jan 2022 08:58:55 +0800 Subject: Re: [PATCH net-next] net/fsl: xgmac_mdio: fix return value check in xgmac_mdio_probe() To: Tobias Waldekranz , "David S. Miller" , Jakub Kicinski , Andrew Lunn , Marcin Wojtas , Calvin Johnson , Markus Koch CC: , , Hulk Robot References: <20220129012702.3220704-1-weiyongjun1@huawei.com> <87czkabjgo.fsf@waldekranz.com> From: "weiyongjun (A)" Message-ID: <2855194d-9680-c78f-ad87-a2b789cc0363@huawei.com> Date: Sun, 30 Jan 2022 08:58:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <87czkabjgo.fsf@waldekranz.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.178.165] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500009.china.huawei.com (7.192.105.203) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > On Sat, Jan 29, 2022 at 01:27, Wei Yongjun wrote: >> In case of error, the function devm_ioremap() returns NULL pointer >> not ERR_PTR(). The IS_ERR() test in the return value check should >> be replaced with NULL test. >> >> Fixes: 1d14eb15dc2c ("net/fsl: xgmac_mdio: Use managed device resources") >> Reported-by: Hulk Robot >> Signed-off-by: Wei Yongjun > Reviewed-by: Tobias Waldekranz > > Sorry about that. I started out by using devm_ioremap_resource, which > uses the in-band error signaling, and forgot to match the guard when I > changed it. > > I see that this was reported by your CI, do you mind me asking what it > is running in the back-end? At least my version of sparse does not seem > to catch this. It was reported by coccinelle with follow script: @@ expression ret, E; @@ ret = \(devm_ioport_map\| devm_ioremap\| devm_ioremap_wc\| devm_irq_alloc_generic_chip\| devm_kasprintf\| devm_kcalloc\| devm_kmalloc\| devm_kmalloc_array\| devm_kmemdup\| devm_kstrdup\| devm_kzalloc\| \)(...); ... when != ret = E ( - IS_ERR(ret) + !ret | - !IS_ERR(ret) + ret | - PTR_ERR(ret) + -ENOMEM ) It seems smatch also can report this. Regards, Wei Yongjun