Skip to contentSkip to conversation

powerpc/iommu/debug: Remove redundant NULL check

PATCH In review Jiapeng Chong 2 participants 3 messages Mar 22, 2021 – Mar 26, 2021 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/iommu/debug: Remove redundant NULL check

Fix the following coccicheck warnings:

./fs/io_uring.c:5989:4-9: WARNING: NULL check before some freeing functions is not needed.

---
 arch/powerpc/kernel/iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/kernel/iommu.c +1 -2
index c00214a..2168714 100644
@@ -72,8 +72,7 @@ static void iommu_debugfs_del(struct iommu_table *tbl)
 
 	sprintf(name, "%08lx", tbl->it_index);
 	liobn_entry = debugfs_lookup(name, iommu_debugfs_dir);
-	if (liobn_entry)
-		debugfs_remove(liobn_entry);
+	debugfs_remove(liobn_entry);
 }
 #else
 static void iommu_debugfs_add(struct iommu_table *tbl){}
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Hi Jiapeng Chong,

Fix the following coccicheck warnings:

./fs/io_uring.c:5989:4-9: WARNING: NULL check before some freeing functions is not needed.

This looks correct to me, and matches the description of debugfs_remove in Documentation/filesystems/debugfs.rst.

If you have a number of similar fixes it might be helpful to do them in a single bigger patch, but I'm not sure if coccicheck reports much else as I don't have coccinelle installed at the moment.

Kind regards,
Daniel

#2 lore raw

Daniel Axtens <[email protected]> writes:

It looks like the kernel test robot also reported this:
"[PATCH] powerpc/iommu/debug: fix ifnullfree.cocci warnings" Weirdly I don't see it in patchwork.

I'm not sure which one mpe will want to take but either would do.

Quoted 4 lines
Quoted 4 lines

Fix the following coccicheck warnings:

./fs/io_uring.c:5989:4-9: WARNING: NULL check before some freeing functions is not needed.

(Also, while unimportant, that's technically not the error you fix here as it's for a different file!)

Quoted 12 lines

This looks correct to me, and matches the description of debugfs_remove in Documentation/filesystems/debugfs.rst.

If you have a number of similar fixes it might be helpful to do them in a single bigger patch, but I'm not sure if coccicheck reports much else as I don't have coccinelle installed at the moment.

Kind regards,
Daniel