Skip to content

Commit

Permalink
mm/swap_state: constify static struct attribute_group
Browse files Browse the repository at this point in the history
The only usage of swap_attr_group is to pass its address to
sysfs_create_group() which takes a pointer to const attribute_group.  Make
it const to allow the compiler to put it in read-only memory.

Link: https://lkml.kernel.org/r/20210201233254.91809-1-rikard.falkeborn@gmail.com
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Reviewed-by: Amy Parker <enbyamy@gmail.com>
Acked-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Rikard Falkeborn authored and Linus Torvalds committed Feb 24, 2021
1 parent 25eaab4 commit e48333b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/swap_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ static struct attribute *swap_attrs[] = {
NULL,
};

static struct attribute_group swap_attr_group = {
static const struct attribute_group swap_attr_group = {
.attrs = swap_attrs,
};

Expand Down

0 comments on commit e48333b

Please sign in to comment.