Message ID | 20190829165025.15750-7-efremov@linux.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v3,01/11] checkpatch: check for nested (un)?likely() calls | expand |
On Thu, Aug 29, 2019 at 07:50:21PM +0300, Denis Efremov wrote: > "unlikely(WARN_ON(x))" is excessive. WARN_ON() already uses unlikely() > internally. > > Signed-off-by: Denis Efremov <efremov@linux.com> > Cc: "Darrick J. Wong" <darrick.wong@oracle.com> > Cc: Joe Perches <joe@perches.com> > Cc: Andrew Morton <akpm@linux-foundation.org> > Cc: linux-xfs@vger.kernel.org LGTM, Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> --D > --- > fs/xfs/xfs_buf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c > index ca0849043f54..4389d87ff0f0 100644 > --- a/fs/xfs/xfs_buf.c > +++ b/fs/xfs/xfs_buf.c > @@ -2096,7 +2096,7 @@ xfs_verify_magic( > int idx; > > idx = xfs_sb_version_hascrc(&mp->m_sb); > - if (unlikely(WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx]))) > + if (WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx])) > return false; > return dmagic == bp->b_ops->magic[idx]; > } > @@ -2114,7 +2114,7 @@ xfs_verify_magic16( > int idx; > > idx = xfs_sb_version_hascrc(&mp->m_sb); > - if (unlikely(WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx]))) > + if (WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx])) > return false; > return dmagic == bp->b_ops->magic16[idx]; > } > -- > 2.21.0 >
On Thu, Aug 29, 2019 at 07:50:21PM +0300, Denis Efremov wrote: > "unlikely(WARN_ON(x))" is excessive. WARN_ON() already uses unlikely() > internally. Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c index ca0849043f54..4389d87ff0f0 100644 --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -2096,7 +2096,7 @@ xfs_verify_magic( int idx; idx = xfs_sb_version_hascrc(&mp->m_sb); - if (unlikely(WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx]))) + if (WARN_ON(!bp->b_ops || !bp->b_ops->magic[idx])) return false; return dmagic == bp->b_ops->magic[idx]; } @@ -2114,7 +2114,7 @@ xfs_verify_magic16( int idx; idx = xfs_sb_version_hascrc(&mp->m_sb); - if (unlikely(WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx]))) + if (WARN_ON(!bp->b_ops || !bp->b_ops->magic16[idx])) return false; return dmagic == bp->b_ops->magic16[idx]; }
"unlikely(WARN_ON(x))" is excessive. WARN_ON() already uses unlikely() internally. Signed-off-by: Denis Efremov <efremov@linux.com> Cc: "Darrick J. Wong" <darrick.wong@oracle.com> Cc: Joe Perches <joe@perches.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: linux-xfs@vger.kernel.org --- fs/xfs/xfs_buf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)