Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1481486rwi; Wed, 26 Oct 2022 16:19:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5o0nxVrJNqND8v5tFxg0zc7aLWqOqV8LoeUzzJWsAgveS3g1yiWY1Uum+dkNVbCJf1YQj6 X-Received: by 2002:a05:6402:b6b:b0:461:b9b2:6d58 with SMTP id cb11-20020a0564020b6b00b00461b9b26d58mr18326660edb.186.1666826343375; Wed, 26 Oct 2022 16:19:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666826343; cv=none; d=google.com; s=arc-20160816; b=ukY0TMVdzGft/v87alG4CgTN2KCWqNIz94L9moKvvpvW4UvlKsErhsIXGAbyBXua2D 6DtlSLhWG/CoRgDZLmCK6mYcmth+iA2M7Q8Mz+YrQRLIV1JbHFG63G2/ovMKEjDbw4kX leQFGN2byzWlbwDtiQ/fRyyXa0ZqMQXEus1ddsbC9mpJL7GdN3C3pWZYjT8HXcC3uaKd x6Uuw8Al3HhrNc8zdQm9gDhdki7VsC5aSVgwo8anV0ot2iBto/cB2u5LWTLUE36kz/BM 0McD2TyMDHWg2fMazXeLTIO5U4DoBAHVLv8ly+BK+KYofrmsyYDpTBsdQnL8J+6uwW9P tpQg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L28YNXLf0uhk0U/cHSmwPZeVXX1Fbjnp962qI+74q7Y=; b=HMBjIKbGtcd0kEBMe3/+fPjjdgXtJYCEqgB9r9j0Oqeb1c3w4XR4kBe6AMc2DYtho3 ia2BH+5XrmEYEJ3iMXemqQ+akLMxkJmo1T2racIsSMniDc0Xv8r1tTOCOe5L3zI8e7Nl HhrAYZtJV8eckOwHJ5ZSsfm3XSeSLQ/9T3FfOCo+RAMfR66wejkNV49Oj5quvMh5lnHO iRgWihDPuhETrm41mzitimn+UuejMTfRm755lydnETLrqdQ5kLVzHaQaEPlCTWPioBC1 Z0RmR0uqgukIH58Dav7vBNjig4h6UshoX0bCas4rB0q58oBYg4J615nyms9w8HEqa9FE tmwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MePX4QP7; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq22-20020a1709073f1600b0078df2f22f80si7604280ejc.647.2022.10.26.16.18.38; Wed, 26 Oct 2022 16:19:03 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MePX4QP7; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233301AbiJZXA1 (ORCPT + 99 others); Wed, 26 Oct 2022 19:00:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234003AbiJZXAA (ORCPT ); Wed, 26 Oct 2022 19:00:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BF7B27CD0 for ; Wed, 26 Oct 2022 15:59:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 274DAB80CA9 for ; Wed, 26 Oct 2022 22:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E743C433D6; Wed, 26 Oct 2022 22:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666825192; bh=8GL00RPKqf41iTTBqJzSvs8lE7BF3n/Dkon2+BFR2Rk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MePX4QP7b/+bsXbvuYDWVKEzt8T7ttgcmo+ROEtbeepA6gq+RAYM+Hsv0n5MZf6HR fOoJ7LQbDBQ7v3IRo7/ROwd6lLUpT6cU9hRCtPe42QeE9yahzPn39o6qYY4HZAXszM WMjWy38qDWJp5lPr52IEJMiGkOi2vR3U/8zKGDomoHsUxjGV1Xms72lV21B8XHV2FX sCZZY9ZwHNRf3X1FJ+/hjUjSHcvpyLLbkxY6mRBWxWaVNLgPZ83mX+cCZkJCdMKZeA 2LIeGNczowR3Brpwwht3QTd/GBnbqwBhiftq+gGAm2xeLrCnxfnX73vg/VLhWky2Nb jHhgtItkwIP6g== From: SeongJae Park To: Andrew Morton Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH v2 06/12] mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc() Date: Wed, 26 Oct 2022 22:59:37 +0000 Message-Id: <20221026225943.100429-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221026225943.100429-1-sj@kernel.org> References: <20221026225943.100429-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 'damon_sysfs_region_alloc()' is always called with zero-filled 'struct damon_addr_range', because the start and end addresses should set by users. Remove unnecessary parameters of the function and simplify the body by using 'kzalloc()'. Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton --- mm/damon/sysfs.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c index b9183063bfea..e8bd7367d15b 100644 --- a/mm/damon/sysfs.c +++ b/mm/damon/sysfs.c @@ -1065,17 +1065,9 @@ struct damon_sysfs_region { struct damon_addr_range ar; }; -static struct damon_sysfs_region *damon_sysfs_region_alloc( - struct damon_addr_range ar) +static struct damon_sysfs_region *damon_sysfs_region_alloc(void) { - struct damon_sysfs_region *region = kmalloc(sizeof(*region), - GFP_KERNEL); - - if (!region) - return NULL; - region->kobj = (struct kobject){}; - region->ar = ar; - return region; + return kzalloc(sizeof(struct damon_sysfs_region), GFP_KERNEL); } static ssize_t start_show(struct kobject *kobj, struct kobj_attribute *attr, @@ -1184,7 +1176,7 @@ static int damon_sysfs_regions_add_dirs(struct damon_sysfs_regions *regions, regions->regions_arr = regions_arr; for (i = 0; i < nr_regions; i++) { - region = damon_sysfs_region_alloc((struct damon_addr_range){}); + region = damon_sysfs_region_alloc(); if (!region) { damon_sysfs_regions_rm_dirs(regions); return -ENOMEM; -- 2.25.1