Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1836974rwb; Fri, 23 Sep 2022 20:43:18 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nBTRpdEmtDgjAbRMpXWok4WfS6HQwlQumXr6JaiV6ZNANWYWTuvEDH7hqRh9V4cZQFzeO X-Received: by 2002:a17:907:3e93:b0:781:c99a:f217 with SMTP id hs19-20020a1709073e9300b00781c99af217mr9422812ejc.517.1663990997862; Fri, 23 Sep 2022 20:43:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663990997; cv=none; d=google.com; s=arc-20160816; b=f1MHaxe07jRXMBlxE2SWLFhfbQLJN2FHshVYjlYk6rF6brAOmkHBYXeDlis/2MALAF ciZX3CA8QMzIWlj3rXiNMHIARIrJuNBP8V34Ozitj56HVdGashisHf9kwZ7AHrBZphjM gftNgJcqkzPuJuUoxT26kRjH6opqUJ1VUQsKcYsYKUxMNJJIQjag7HUAslpTw/xvuqfq ETU8h8QjVWBro0lMbb2hZ+dE4dIh/tbA+oProWrnxPmFVuUcdTExnikhITy9kwcrJ2cl F/+F1UDmilCChnMjnX3fmSEB5SbVwHeRA6vrqxMSzcr9r3PsA9I77SBu2eU22KD5b9KD lQuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hYgqSZT430T0dpp9HYvLmdgJglcqQNwSgIWS/eQusQ8=; b=bssZiNMM8G/qYlT9cuLgMmOJn51gLajJ88+FyknRNUrV9SYKi+TqoD4G0mvqQfvejU j4srehfAaia0FdT8OusUjbE7FmzmUqY8+l76PKuEp726H6UZh5nusJHQ0LJ8MYr8bt7X 8gLdcYwVdL6GrMZHXyKM/NzxVj/P6ufBizy8SxGwyiBHAqZ8+qh2veHV29L7z4TAddMw yQAyfaNbYlImyGKrnqYL1ss25VE5lA26b2qYcKTugigVhoROzaXEmXcb8gegjkQLBuHM effvikGs0V0CD2gHoGAykvbMWfaE1OIBHz4FxeR4P/wamukP7l5BKpV74q3lRtrXm2TN a8hw== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w11-20020a05640234cb00b0044ea4c5a78dsi12228105edc.158.2022.09.23.20.42.51; Fri, 23 Sep 2022 20:43:17 -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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233075AbiIXDKw (ORCPT + 99 others); Fri, 23 Sep 2022 23:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbiIXDKt (ORCPT ); Fri, 23 Sep 2022 23:10:49 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40A1047B8A; Fri, 23 Sep 2022 20:10:48 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MZDVp0HlczHnt6; Sat, 24 Sep 2022 11:08:34 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 11:10:46 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 24 Sep 2022 11:10:45 +0800 From: Sun Ke To: , CC: , , , , Subject: [PATCH] drivers/perf: fix return value check in ali_drw_pmu_probe() Date: Sat, 24 Sep 2022 11:21:27 +0800 Message-ID: <20220924032127.313156-1-sunke32@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 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 --- 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)); -- 2.31.1