mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xfs:Comparisons should place the constant on the right side of the test The if statement uses an assignment statement as a condition,  which is confusing.
       [not found] <tencent_31C29C1E7BD35451F49750644121169CB608@qq.com>
@ 2023-07-14  6:26 ` liubin001
  2023-07-14  6:35   ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: liubin001 @ 2023-07-14  6:26 UTC (permalink / raw)
  To: djwong; +Cc: linux-xfs, linux-kernel

xfs:The if statement uses an assignment statement as a condition, which 
is confusing.
Signed-off-by: Liu Bin <liubin001@208suo.com>
---
  fs/xfs/xfs_trans_dquot.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_trans_dquot.c b/fs/xfs/xfs_trans_dquot.c
index aa00cf67ad72..b429e95e425a 100644
--- a/fs/xfs/xfs_trans_dquot.c
+++ b/fs/xfs/xfs_trans_dquot.c
@@ -361,7 +361,8 @@ xfs_trans_apply_dquot_deltas(
               * The array of dquots is filled
               * sequentially, not sparsely.
               */
-            if ((dqp = qtrx->qt_dquot) == NULL)
+            dqp = qtrx->qt_dquot;
+            if (dqp == NULL)
                  break;

              ASSERT(XFS_DQ_IS_LOCKED(dqp));
@@ -492,8 +493,10 @@ xfs_trans_unreserve_and_mod_dquots(
              /*
               * We assume that the array of dquots is filled
               * sequentially, not sparsely.
+             *
               */
-            if ((dqp = qtrx->qt_dquot) == NULL)
+            dqp = qtrx->qt_dquot
+            if (dqp == NULL)
                  break;
              /*
               * Unreserve the original reservation. We don't care

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

* Re: [PATCH] xfs:Comparisons should place the constant on the right side of the test The if statement uses an assignment statement as a condition, which is confusing.
  2023-07-14  6:26 ` [PATCH] xfs:Comparisons should place the constant on the right side of the test The if statement uses an assignment statement as a condition, which is confusing liubin001
@ 2023-07-14  6:35   ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2023-07-14  6:35 UTC (permalink / raw)
  To: liubin001; +Cc: djwong, linux-xfs, linux-kernel

On Fri, Jul 14, 2023 at 02:26:08PM +0800, liubin001@208suo.com wrote:
> xfs:The if statement uses an assignment statement as a condition, which is
> confusing.
> Signed-off-by: Liu Bin <liubin001@208suo.com>

What's the point?  I prefer the style you change it to as well, but
there is no real downside, and changing code just for the sake of it
causes nothing but churn.


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

end of thread, other threads:[~2023-07-14  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <tencent_31C29C1E7BD35451F49750644121169CB608@qq.com>
2023-07-14  6:26 ` [PATCH] xfs:Comparisons should place the constant on the right side of the test The if statement uses an assignment statement as a condition, which is confusing liubin001
2023-07-14  6:35   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®