Skip to contentSkip to conversation

swiotlb: drop pointless static qualifier in swiotlb_dma_supported()

PATCH Superseded YueHaibing 2 participants 4 messages Feb 14, 2019

Subsystems (2)
lore
Share & tools
lore

YueHaibing

author
#0 lore raw

PATCH 1/1 swiotlb: drop pointless static qualifier in swiotlb_dma_supported()

There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it.

---
 kernel/dma/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/swiotlb.c +1 -1
index a7b53786db9f..02fa517c47d9 100644
@@ -689,7 +689,7 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask)
 
 static int __init swiotlb_create_debugfs(void)
 {
-	static struct dentry *d_swiotlb_usage;
+	struct dentry *d_swiotlb_usage;
 	struct dentry *ent;
 
 	d_swiotlb_usage = debugfs_create_dir("swiotlb", NULL);
#1 lore raw
Quoted 2 lines · YueHaibing

There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it.

FYI, this is in swiotlb_create_debugfs, not swiotlb_dma_supported.

author
#2 lore raw
Quoted 5 lines · Christoph Hellwig
Quoted 2 lines · YueHaibing

There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it.

FYI, this is in swiotlb_create_debugfs, not swiotlb_dma_supported.

Thank you, I will fix it.

Quoted 3 lines

.

author
#3 lore raw

PATCH v2 1/1 swiotlb: drop pointless static qualifier in swiotlb_create_debugfs()

In reply to YueHaibing

There is no need to have the 'struct dentry *d_swiotlb_usage' variable static since new value always be assigned before use it.

---
v2: fix patch title

---
 kernel/dma/swiotlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/swiotlb.c +1 -1
index a7b53786db9f..02fa517c47d9 100644
@@ -689,7 +689,7 @@ swiotlb_dma_supported(struct device *hwdev, u64 mask)
 
 static int __init swiotlb_create_debugfs(void)
 {
-	static struct dentry *d_swiotlb_usage;
+	struct dentry *d_swiotlb_usage;
 	struct dentry *ent;
 
 	d_swiotlb_usage = debugfs_create_dir("swiotlb", NULL);