Skip to contentSkip to conversation

kernfs: Remove redundant code

PATCH In review Abaci Team 2 participants 2 messages Jan 28, 2021 kernfs

lore
Share & tools
lore

Abaci Team

author
#0 lore raw

PATCH 1/1 kernfs: Remove redundant code

Fix the following coccicheck warnings:

./fs/kernfs/file.c:647:1-3: WARNING: possible condition with no effect (if == else).

---
 fs/kernfs/file.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/kernfs/file.c +1 -5
index c757193..9a74c9d 100644
@@ -644,11 +644,7 @@ static int kernfs_fop_open(struct inode *inode, struct file *file)
 	 * Both paths of the branch look the same.  They're supposed to
 	 * look that way and give @of->mutex different static lockdep keys.
 	 */
-	if (has_mmap)
-		mutex_init(&of->mutex);
-	else
-		mutex_init(&of->mutex);
-
+	mutex_init(&of->mutex);
 	of->kn = kn;
 	of->file = file;
 
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw
Quoted 17 lines · Abaci Team

Fix the following coccicheck warnings:

./fs/kernfs/file.c:647:1-3: WARNING: possible condition with no effect (if == else).

---
 fs/kernfs/file.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/kernfs/file.c +0 -0
index c757193..9a74c9d 100644

fs/kernfs/file.c static int kernfs_fop_open(struct inode *inode, struct file *file) · line 645

Quoted 2 lines
fs/kernfs/file.c +0 -0
@@ -644,11 +644,7 @@ static int kernfs_fop_open(struct inode *inode, struct file *file)
 	 * Both paths of the branch look the same.  They're supposed to
 	 * look that way and give @of->mutex different static lockdep keys.

Please read the comment right above.

Thanks.

Signature · 1 line
tejun