Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7486382rwi; Mon, 24 Oct 2022 15:36:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM51AWCYTFy7Tp92CDlZOswn5a7XmvjFlJW0qi1yKNzmczMcTyjc1fgblwQOSSO/sMMISAkP X-Received: by 2002:a05:6402:35cc:b0:45d:4a39:2a43 with SMTP id z12-20020a05640235cc00b0045d4a392a43mr33017867edc.304.1666651012443; Mon, 24 Oct 2022 15:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666651012; cv=none; d=google.com; s=arc-20160816; b=0SzZsrXLH1tgc/4ameRxx7XPo+V2xesC/JjF2sgTKcGa9cg/0Enq+e8hUbTVcipRpS HnSgsiWxTJgpu9JqAGMavgwnWkgprRb97yXaeszwMyf0WpkMVBo7oX7OuVUsnVvYPUTD hEOH3isulWSem3i5bdxrl9mi7Ybd7cMK8I79YjGpkwczeLpx2+QRDKe0QYjHDk4W04wt 7tx9mBOGa0lMuBfUspLqj72UquAh6AhD9pDZfkJB3nD0hB2Qduo1L1t5tOQBKleL8BXh 9yYM/n2AFZxA01kVbTwBSyP6ebERTVaO/Rx5CaXu76Sma1EtGQCdg0rmCcMtuAbmmX0T hEmg== 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=mr90G6ZMuhnsX/SfPy3lt8a8rjK7AgwVrTpEY47GZ4gZVaJmS4c1m2qCqxx8GkL0Tw M/0jZ1yC/YCNkKvG2DESismCzOifyso6lo+N64GQmLNC0yv8BpJdVvy44BhkDaHO5LXC dQp8C6eqwhP1eRvNEK3gY+tuyoBOB7ncfebSQH7OQ1wD+XRoEqh5AIeT98oFCdje5noT SHZWpmFFzyltXdCV1hhZmKOMpJaO3tN0G/j/eVh53/zwq9k85guvSEM3qG9rZEzLn0LP w1Vywr92Grpp4h+eCj+k2TapzG7CP9oYnOP23BeGU0j/Rx8eKJN49i1Q3aQ1mQUgKe2n lILw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G0PNJwF7; 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 cf14-20020a0564020b8e00b00461dbe292e0si775835edb.270.2022.10.24.15.36.27; Mon, 24 Oct 2022 15:36:52 -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=G0PNJwF7; 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 S230493AbiJXWdj (ORCPT + 99 others); Mon, 24 Oct 2022 18:33:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbiJXWdT (ORCPT ); Mon, 24 Oct 2022 18:33:19 -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 78AF12BE880 for ; Mon, 24 Oct 2022 13:56:12 -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 D3772B811FB for ; Mon, 24 Oct 2022 20:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C5A2C433D6; Mon, 24 Oct 2022 20:49:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666644568; bh=ujSci3Jr9yWO8XdHXzr/zi1RpAlYDD3yaad0xsGDwtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0PNJwF7F8B6wDCT8U5OvUuUzVBgp8YQ/xYp56NtYF3J+apq8tV363lbDS/dAVE9x fmE1KhGzme+66U40xnPxhCiGER08YnmCVpFOOoXzMNwJdsHg9XkhE0h2IglBKku8Qk 0R3GZqSNZtFaMKpOjz9jv3aamgzvzty7b1BBMqBiUTBM5Z3QCKDU2LJ1lVnuJfzih4 YiMPbVNMnUXZTngRymS02lmsG8cD41erv/DtQA2mKokmw5y+4FXwKDV4hBH/tUKLJY 2YNKfkUPrm/R4hseLEskL/AinkQdMCyRdNeV3Gza0l5JxjrTscQ6MhU4BaaSFDNiXW zkY/9xpZ6LDRg== From: SeongJae Park To: SeongJae Park , Andrew Morton Cc: damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/11] mm/damon/sysfs: remove parameters of damon_sysfs_region_alloc() Date: Mon, 24 Oct 2022 20:49:14 +0000 Message-Id: <20221024204919.18524-7-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221024204919.18524-1-sj@kernel.org> References: <20221024204919.18524-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 --- 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