Linux-Block Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] blk-sysfs: Make structure queue_attr_group constant
@ 2019-08-13  8:55 Nishka Dasgupta
  0 siblings, 0 replies; only message in thread
From: Nishka Dasgupta @ 2019-08-13  8:55 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: Nishka Dasgupta

The static structure queue_attr_group is used only once, when it is
passed as the second argument to the function sysfs_create_group().
However, the second parameter of sysfs_create_group() is already defined
as constant. Hence make queue_attr_group itself constant, as it is never
modified.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
 block/blk-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 977c659dcd18..9401b0cc2e29 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -783,7 +783,7 @@ static umode_t queue_attr_visible(struct kobject *kobj, struct attribute *attr,
 	return attr->mode;
 }
 
-static struct attribute_group queue_attr_group = {
+static const struct attribute_group queue_attr_group = {
 	.attrs = queue_attrs,
 	.is_visible = queue_attr_visible,
 };
-- 
2.19.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13  8:55 [PATCH] blk-sysfs: Make structure queue_attr_group constant Nishka Dasgupta

Linux-Block Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-block/0 linux-block/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-block linux-block/ https://lore.kernel.org/linux-block \
		linux-block@vger.kernel.org linux-block@archiver.kernel.org
	public-inbox-index linux-block


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-block


AGPL code for this site: git clone https://public-inbox.org/ public-inbox