linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/tls: Remove redundant initialization of mp
@ 2021-12-31 12:23 Jiapeng Chong
  2022-01-01  3:57 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2021-12-31 12:23 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, linux-kernel, Jiapeng Chong, Abaci Robot

mp is being initialized to log->l_mp but this is never read
as record is overwritten later on. Remove the redundant
initialization.

Cleans up the following clang-analyzer warning:

fs/xfs/xfs_log_recover.c:3543:20: warning: Value stored to 'mp' during
its initialization is never read [clang-analyzer-deadcode.DeadStores].

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 fs/xfs/xfs_log_recover.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 8ecb9a8567b7..9142efbdc670 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3540,7 +3540,7 @@ STATIC void
 xlog_recover_check_summary(
 	struct xlog		*log)
 {
-	struct xfs_mount	*mp = log->l_mp;
+	struct xfs_mount	*mp;
 	struct xfs_perag	*pag;
 	struct xfs_buf		*agfbp;
 	struct xfs_buf		*agibp;
-- 
2.20.1.7.g153144c


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

* Re: [PATCH] net/tls: Remove redundant initialization of mp
  2021-12-31 12:23 [PATCH] net/tls: Remove redundant initialization of mp Jiapeng Chong
@ 2022-01-01  3:57 ` Dave Chinner
  2022-01-04  1:35   ` Darrick J. Wong
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2022-01-01  3:57 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: djwong, linux-xfs, linux-kernel, Abaci Robot

On Fri, Dec 31, 2021 at 08:23:52PM +0800, Jiapeng Chong wrote:
> mp is being initialized to log->l_mp but this is never read
> as record is overwritten later on. Remove the redundant
> initialization.

The compiler is not smart enough to just elide the second "mp =
log->l_mp;" assignment?


> Cleans up the following clang-analyzer warning:
> 
> fs/xfs/xfs_log_recover.c:3543:20: warning: Value stored to 'mp' during
> its initialization is never read [clang-analyzer-deadcode.DeadStores].
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  fs/xfs/xfs_log_recover.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 8ecb9a8567b7..9142efbdc670 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -3540,7 +3540,7 @@ STATIC void
>  xlog_recover_check_summary(
>  	struct xlog		*log)
>  {
> -	struct xfs_mount	*mp = log->l_mp;
> +	struct xfs_mount	*mp;
>  	struct xfs_perag	*pag;
>  	struct xfs_buf		*agfbp;
>  	struct xfs_buf		*agibp;

You removed the wrong initialisation line. Leave this one here and
remove the standalone one.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

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

* Re: [PATCH] net/tls: Remove redundant initialization of mp
  2022-01-01  3:57 ` Dave Chinner
@ 2022-01-04  1:35   ` Darrick J. Wong
  0 siblings, 0 replies; 3+ messages in thread
From: Darrick J. Wong @ 2022-01-04  1:35 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Jiapeng Chong, linux-xfs, linux-kernel, Abaci Robot

On Sat, Jan 01, 2022 at 02:57:16PM +1100, Dave Chinner wrote:
> On Fri, Dec 31, 2021 at 08:23:52PM +0800, Jiapeng Chong wrote:
> > mp is being initialized to log->l_mp but this is never read
> > as record is overwritten later on. Remove the redundant
> > initialization.
> 
> The compiler is not smart enough to just elide the second "mp =
> log->l_mp;" assignment?

It is, but it would seem, alas, that people with AIs want to waste both
our time reviewing trivial (and WRONG!) changes generated by automated
tools that duplicate functionality long available in automated tools.

It would be /really awesome/ if these people with giant farms of servers
could instead turn their attention towards finding deeper functionality
bugs and design thinkos in less well tested code paths (like rt and
quota) so that Leah and I aren't the only ones...

> > Cleans up the following clang-analyzer warning:
> > 
> > fs/xfs/xfs_log_recover.c:3543:20: warning: Value stored to 'mp' during
> > its initialization is never read [clang-analyzer-deadcode.DeadStores].
> > 
> > Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> > ---
> >  fs/xfs/xfs_log_recover.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> > index 8ecb9a8567b7..9142efbdc670 100644
> > --- a/fs/xfs/xfs_log_recover.c
> > +++ b/fs/xfs/xfs_log_recover.c
> > @@ -3540,7 +3540,7 @@ STATIC void
> >  xlog_recover_check_summary(
> >  	struct xlog		*log)
> >  {
> > -	struct xfs_mount	*mp = log->l_mp;
> > +	struct xfs_mount	*mp;
> >  	struct xfs_perag	*pag;
> >  	struct xfs_buf		*agfbp;
> >  	struct xfs_buf		*agibp;
> 
> You removed the wrong initialisation line. Leave this one here and
> remove the standalone one.

...and fix the subject line, this isn't networking code.

--D

> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com

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

end of thread, other threads:[~2022-01-04  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-31 12:23 [PATCH] net/tls: Remove redundant initialization of mp Jiapeng Chong
2022-01-01  3:57 ` Dave Chinner
2022-01-04  1:35   ` Darrick J. Wong

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).