From patchwork Thu Nov 10 03:07:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 17936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp701024wru; Wed, 9 Nov 2022 19:21:43 -0800 (PST) X-Google-Smtp-Source: AMsMyM5aQx238vBbnpIV3SZPH15QmuQF45FljMes3SIw0k3Q8h2Ko/HTdg5Jg8Nx+3e3TA8JrJ+f X-Received: by 2002:aa7:d0c5:0:b0:464:39e1:68f8 with SMTP id u5-20020aa7d0c5000000b0046439e168f8mr34531717edo.34.1668050502832; Wed, 09 Nov 2022 19:21:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668050502; cv=none; d=google.com; s=arc-20160816; b=o4rom7VfLp+hszJJSUm+yNpye7bxwiKTW0y1o/q6E+wuPiKJzeAifRUIi9nl6o0Xvo mh3aeMMcevaApn4ejXtWIm2Q7J8Ukm+GvAvGduTl3fCp4aphrv8M1MN/y7KzIn4z70Wu wZs91u2pm0ZYSadXf9VBMd6MBCkJ97x232YI4GCtAF/QSg1BMYtfzjcMUP0+b6fI+DgO HPjXaInLDe5F5Zd4rxX1wfGSg1Joq5VX8kKaa1Z0DwBbxTY0iq2S0S5lpJ5EBXa+HFL8 hNOCs6UZ7zGOITd8zPwhLMy8+CRxTzTAYNXK+NOTrwTy9yDSf4GbhicwwzXhEo7BMKx2 h60g== 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:dkim-signature; bh=Y6OU4ENNozkhINhc2+IJdoCoJp+Y8ceNlE8roxKPBjE=; b=T3fz6/mEB4BJW5JsBzsoRBQyS7WcXp4dF1b+hmZJS/nne5cc01pIigy5cRAmGtY3FR LY6NJMSci9ViQeV8dPGqLZm3EjUxcmwjLaEaDtKuupP16E3x7+tnxDvTWTyEe1rR3c8K J6h8cYJPQC4zMQWZ1mtHIDDedTi9CcX81vgV6++35LAkpnduzwRKIwRpIUVHmNAJGaQx Z77Q3Ti8PijtBrZyfH81hENPl/C9EgEGt0MMAlVE4BhI8w2J3ttVIxvWrgccfKelTWsr XibDCSThcq2JApUrhxBbRjjjVQLElRxtTBThx5emgXxOUp4Ua7EqWvz/LNdlogWI2ejq keEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oaJmLTjf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xh14-20020a170906da8e00b0078e063fc787si18799032ejb.433.2022.11.09.19.21.19; Wed, 09 Nov 2022 19:21:42 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oaJmLTjf; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232058AbiKJDIF (ORCPT + 99 others); Wed, 9 Nov 2022 22:08:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbiKJDIB (ORCPT ); Wed, 9 Nov 2022 22:08:01 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC5B27DDF for ; Wed, 9 Nov 2022 19:08:01 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id b11so586341pjp.2 for ; Wed, 09 Nov 2022 19:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Y6OU4ENNozkhINhc2+IJdoCoJp+Y8ceNlE8roxKPBjE=; b=oaJmLTjfJVaa50Gd8bDUYhN/nxHUbBZEnP+s0IbUrmsk5dtTaf/iqkrlaswYcgxT/l /Ssntrn5Fqaaj1VCXld7535lk2/u7QmvZPTBGHljv/7Nj96/3Qa8p+T4Ta9cX5gOZX+v 1nj3qCWZE4K+fhQ3z1pAd2QJfJtx3kc54c7wnzQpQOOa1X7QnUnrZUvtIulF9RvGWIDz wy7EVVA0A9GUcWoiwptyhBcT2xQJ6vLWh1GY3MXfhjHKySMpXNvH9W1C0XdNIjFff4fC Es5/daXC9Ysst7KAWH+b0HLY86EBUeUtYQGxLmyUlsQAyyYALoTwSe+zWYCWsYgk6ngq Nspw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Y6OU4ENNozkhINhc2+IJdoCoJp+Y8ceNlE8roxKPBjE=; b=Y2XQjmR44gBrEOGFNhmxbN4nM3vh9iJ9tJaTzEWUagNNmxjACFMjoeEXvP2I0pZ6K7 GlHj83LDB3lyYeO6RoYLzJ7P99DPUh3Y9yVw+iJdIdxJDPzGmxkImR2YwljVLgjn/fvG 0AAJToROeBjjPz8p0oMaCfWhKshc+bwUTJOgL4hmPp51WSQI5xvxDWdD5KTE4UhS/xBh 5gHdGFTtCHrnpsLsULLl9u184cPXSa6tSITGOxeG74DIYofO2RwYIi6R8XttCyPSYnX9 vy19dnHqj/wGoTXtmva3spv+/s+a+ZpyTbT4eBr6oP+VcuSne1JZ3jPOvuCbzuUfWUJ7 +/+Q== X-Gm-Message-State: ACrzQf0O74wT/l0IaYq0NkcQXTrEizZepfYhq/HlpsqH6KO7frzxx+4t +Iv0FTjSBXMD9sFoxgYIbMI= X-Received: by 2002:a17:902:c405:b0:187:76e:2891 with SMTP id k5-20020a170902c40500b00187076e2891mr57723416plk.25.1668049680817; Wed, 09 Nov 2022 19:08:00 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id kx4-20020a17090b228400b002008d0e5cb5sm1906221pjb.47.2022.11.09.19.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 19:08:00 -0800 (PST) From: Miaoqian Lin To: Andrew Morton , Wei Xu , "Huang, Ying" , "Aneesh Kumar K.V" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH] mm/demotion: Fix NULL vs IS_ERR checking in memory_tier_init Date: Thu, 10 Nov 2022 07:07:51 +0400 Message-Id: <20221110030751.1627266-1-linmq006@gmail.com> X-Mailer: git-send-email 2.37.3.671.ge2130fe6da78.dirty MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749077627062862738?= X-GMAIL-MSGID: =?utf-8?q?1749077724369021432?= The alloc_memory_type() function return error pointers on error instead of NULL. Use IS_ERR() to check the return value to fix this. Fixes: 7b88bda3761b ("mm/demotion/dax/kmem: set node's abstract distance to MEMTIER_DEFAULT_DAX_ADISTANCE") Signed-off-by: Miaoqian Lin --- mm/memory-tiers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c index fa8c9d07f9ce..ac0dae9e54bf 100644 --- a/mm/memory-tiers.c +++ b/mm/memory-tiers.c @@ -645,7 +645,7 @@ static int __init memory_tier_init(void) * than default DRAM tier. */ default_dram_type = alloc_memory_type(MEMTIER_ADISTANCE_DRAM); - if (!default_dram_type) + if (IS_ERR(default_dram_type)) panic("%s() failed to allocate default DRAM tier\n", __func__); /*