linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernfs: Remove redundant code
@ 2021-01-28  8:25 Abaci Team
  2021-01-28 16:39 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Abaci Team @ 2021-01-28  8:25 UTC (permalink / raw)
  To: gregkh; +Cc: tj, linux-kernel, Abaci Team

Fix the following coccicheck warnings:

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Suggested-by: Jiapeng Zhong <oswb@linux.alibaba.com>
Signed-off-by: Abaci Team <abaci-bugfix@linux.alibaba.com>
---
 fs/kernfs/file.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index c757193..9a74c9d 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -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;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kernfs: Remove redundant code
  2021-01-28  8:25 [PATCH] kernfs: Remove redundant code Abaci Team
@ 2021-01-28 16:39 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2021-01-28 16:39 UTC (permalink / raw)
  To: Abaci Team; +Cc: gregkh, linux-kernel

On Thu, Jan 28, 2021 at 04:25:32PM +0800, Abaci Team wrote:
> Fix the following coccicheck warnings:
> 
> ./fs/kernfs/file.c:647:1-3: WARNING: possible condition with no effect
> (if == else).
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Suggested-by: Jiapeng Zhong <oswb@linux.alibaba.com>
> Signed-off-by: Abaci Team <abaci-bugfix@linux.alibaba.com>
> ---
>  fs/kernfs/file.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
> index c757193..9a74c9d 100644
> --- a/fs/kernfs/file.c
> +++ b/fs/kernfs/file.c
> @@ -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.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-28 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-28  8:25 [PATCH] kernfs: Remove redundant code Abaci Team
2021-01-28 16:39 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).