Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp252015rwi; Tue, 18 Oct 2022 17:17:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4GDlPWdbseWwktsgX4J9V5vx8QON/ukzjRmdW4+uEiUuiiUL4O37wUvbuYVMcFfyH6jZmw X-Received: by 2002:a17:907:8a27:b0:78e:274e:9235 with SMTP id sc39-20020a1709078a2700b0078e274e9235mr4581491ejc.754.1666138621382; Tue, 18 Oct 2022 17:17:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666138621; cv=none; d=google.com; s=arc-20160816; b=zmjPcUMfZUuQUNeXoIu9+p3iAG+nq9WEwfrbgh+5Cm0h5qYLNpzfZ/kjLXfO0oiTVG 8KVZy+uKlnLjI+6pqCazjVxDolIb5rNyy20A053KTKBbsvtkaeL5m1egpfgoXD+atM5r sizSV3fTKJVivbsmFZMfj1GKYIhjdC+KqoDxPzRhDYz34BGblXKh5/qclBxahyi19wjM oZDqrWIYWLYfr9+HMs7QS1AunktkHAiPbYiBcWyB08Gt5trmKiq4vYHsa4JNPnu3W0r1 kZKrlbiMrNp2GH+vV47jVI//SMb/ss60tkA53w7FY3UWuFRh/Ci+67yOXzkTrqAgzNgR x1Fw== 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=03ly8U/KAwHOuI8XWF1KHkMMfsjMuz58ZNQJDMju10o=; b=bexn4CptwJegGajSqQT0r/9ap4rAjp7ZPIa2WTGDg5xjLnAUqGbfYXxQZQ7Gr+iOmO Xuvu9BF02P70wRZYOpV88vecOc9bMn2d9DnloELLTN1m1BvZYrzA03do7JyCXHFk8Dm3 qccqezTomipHPW2ysgfxpoyQ1WNX3dsZgwa+uMT0Z6Zzfj8ob46VjVJt52C8p4lX31Z4 rSX5qN1vvmZYiyQTgjb5f84WMAvBvfClQs9+BZPVgHtwkMIWIGV1u2nImN2d6AgFzGDt wwvGiU5OhbWzFsPHl5uT45hguwkfwb6ETiv34OhEq/k91p4xgzUXMSydpaNmCfPiu+i1 SZqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jqdDiFtC; 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 m22-20020a056402051600b0045961c7dde9si11245262edv.63.2022.10.18.17.16.36; Tue, 18 Oct 2022 17:17:01 -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=jqdDiFtC; 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 S229498AbiJSANv (ORCPT + 99 others); Tue, 18 Oct 2022 20:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229795AbiJSAN3 (ORCPT ); Tue, 18 Oct 2022 20:13:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 568A1D57D7 for ; Tue, 18 Oct 2022 17:13:28 -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 dfw.source.kernel.org (Postfix) with ESMTPS id E48AD61739 for ; Wed, 19 Oct 2022 00:13:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03394C43143; Wed, 19 Oct 2022 00:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666138407; bh=ujSci3Jr9yWO8XdHXzr/zi1RpAlYDD3yaad0xsGDwtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jqdDiFtCwIgZRauAibxFTY0xxMT21TP4sJWBZxuoXVCoBeOE/nUzDBSSKb/XDoolr H3hSh8l2G2xHPvF3K1Wcf/Yi8+zX88kHSAj0bc242eWmBspKXRxucRxMtRSqYKPaBY N7ahcK87QvjxtfusnABfcZ9nQcZ26u5nJwi/zxHvzTVOEwG/ojX+OKcnQvvrBwJcIy ONFBk8PmkaL3RjDbJCO5g051DKHayZL1Dvf4OMRKr7MITxJqMFNs+NBnLq39y3EXRE ZAeuYmtbGwiRmVaFB1xLiL9jy1IALkSv5U4bZxSHeqVVV22jSTGHSc0ToUcdMWPjFa n6IBUKynEQUGA== From: SeongJae Park To: SeongJae Park , Andrew Morton Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 08/18] mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc() Date: Wed, 19 Oct 2022 00:13:07 +0000 Message-Id: <20221019001317.104270-9-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019001317.104270-1-sj@kernel.org> References: <20221019001317.104270-1-sj@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 --- 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