From: Dan Williams Date: Wed, 16 Sep 2009 19:11:54 +0000 (-0700) Subject: md/raid6: eliminate BUG_ON with side effect X-Git-Tag: v2.6.32-rc1~60^2^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d6e4ecc87d20299bcb249dd62efbd73496744c3;p=thirdparty%2Fkernel%2Flinux.git md/raid6: eliminate BUG_ON with side effect As pointed out by Neil it should be possible to build a driver with all BUG_ON statements deleted. It's bad form to have a BUG_ON with a side effect. Signed-off-by: Dan Williams --- diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 9b00a229015a2..0a5f03d93aef3 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -3214,8 +3214,10 @@ static bool handle_stripe6(struct stripe_head *sh) /* now count some things */ if (test_bit(R5_LOCKED, &dev->flags)) s.locked++; if (test_bit(R5_UPTODATE, &dev->flags)) s.uptodate++; - if (test_bit(R5_Wantcompute, &dev->flags)) - BUG_ON(++s.compute > 2); + if (test_bit(R5_Wantcompute, &dev->flags)) { + s.compute++; + BUG_ON(s.compute > 2); + } if (test_bit(R5_Wantfill, &dev->flags)) { s.to_fill++;