Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp208803rwb; Sun, 25 Sep 2022 18:53:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MyhotKXbHC4wNaWHfGyOsfZgc9WiVv+w1SoUDI1h/l+tNEXF5B1p4+9k76UZ/nlZ/sPJk X-Received: by 2002:a17:907:31ca:b0:780:2170:e08c with SMTP id xf10-20020a17090731ca00b007802170e08cmr16404393ejb.145.1664157224202; Sun, 25 Sep 2022 18:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664157224; cv=none; d=google.com; s=arc-20160816; b=T4pD7dwJ1IdWw4Fd5h8yEQfqdlU1ogM31vxmx2LWxicCZEYP/hca2soaHtqhbt17ki gSxJ0/QBwXfsLhM6NcUQ+/oXgroFQXDZtO/cYEgr358BwogQ9mPGMUbuTxXFoViaf2AF w4AhAXz+5xKj7Jd7O/+mL7UHka4iHCy8d29uTnW4rpBnh4Thll2b384kKFDldFVu5Dej pN49jbe3azwC4fjMtEGZc3U6Rin/FwVQpHT58ZVdgbLAXQYuY7qsIACZkQrv4lpXSh/r fTnxuepgv4NwMQSOHcbkCkhLVWIJSVm6hQ/oaeQBDYcYspBQRt0/C93lUBhmdn6QVbvL XLww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ROhOmzys58uW2gTPJ0R9T5pYGnBQ2eL+lScW4+3P1o4=; b=eh4LolScq/Xt782kwv9d53+RXtgsnk0vew1IJfsgCDqOJcqUdhz7zOESTIsWv3PJY6 9sqb089c+ZYAME1Ob/iDiF5l2U/jLzUSL7SpXnC/pV1yrdMKjjIHgzvzA5sEqR7a4qbs EoUvx7A6p8Or/9JQsSTwaL2r/aHIfNX78QGTNGleEYtkGv+l/H/vCCTwq+ykGxAaPLOO feuwifnnqR2jzBYt7xvc8hN9SACLk02U7dVjKKgbYM5tsj6MOXHtYNNBHM9/7ZwS7phS ODD7iXf7DuIqJge35ZTJLE6gJ0dRqDfiyMc/Kib5wMJ/Nq+nSyFfe4a6lqmcdk4bTZP0 GrTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn21-20020a1709070d1500b007330c08fe49si16715341ejc.206.2022.09.25.18.53.18; Sun, 25 Sep 2022 18:53:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232185AbiIZBOr (ORCPT + 99 others); Sun, 25 Sep 2022 21:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbiIZBOn (ORCPT ); Sun, 25 Sep 2022 21:14:43 -0400 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F22C6341; Sun, 25 Sep 2022 18:14:40 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R481e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=xueshuai@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VQe-WH6_1664154876; Received: from 30.240.121.51(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0VQe-WH6_1664154876) by smtp.aliyun-inc.com; Mon, 26 Sep 2022 09:14:37 +0800 Message-ID: <58b7485d-94fa-f333-ff14-9a4a1ce0284a@linux.alibaba.com> Date: Mon, 26 Sep 2022 09:14:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH] drivers/perf: fix return value check in ali_drw_pmu_probe() Content-Language: en-US To: Sun Ke , will@kernel.org, mark.rutland@arm.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20220924032127.313156-1-sunke32@huawei.com> From: Shuai Xue In-Reply-To: <20220924032127.313156-1-sunke32@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/9/24 AM11:21, Sun Ke 写道: > In case of error, devm_ioremap_resource() returns ERR_PTR(), > and never returns NULL. The NULL test in the return value > check should be replaced with IS_ERR(). > > Fixes: cf7b61073e45 ("drivers/perf: add DDR Sub-System Driveway PMU driver for Yitian 710 SoC") > Signed-off-by: Sun Ke Good catch, thank you for fixing. Reviewed-by: Shuai Xue Cheers, Shuai > --- > drivers/perf/alibaba_uncore_drw_pmu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/perf/alibaba_uncore_drw_pmu.c b/drivers/perf/alibaba_uncore_drw_pmu.c > index 82729b874f09..a7689fecb49d 100644 > --- a/drivers/perf/alibaba_uncore_drw_pmu.c > +++ b/drivers/perf/alibaba_uncore_drw_pmu.c > @@ -658,8 +658,8 @@ static int ali_drw_pmu_probe(struct platform_device *pdev) > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > drw_pmu->cfg_base = devm_ioremap_resource(&pdev->dev, res); > - if (!drw_pmu->cfg_base) > - return -ENOMEM; > + if (IS_ERR(drw_pmu->cfg_base)) > + return PTR_ERR(drw_pmu->cfg_base); > > name = devm_kasprintf(drw_pmu->dev, GFP_KERNEL, "ali_drw_%llx", > (u64) (res->start >> ALI_DRW_PMU_PA_SHIFT));