This is my first attempt at a patch so I am submitting it just for
review so i can get some feedback on, if I did it correctly and if i
need to do anything different. I did test compile this patch into the
kernel using allmodconfig with gcc and had no errors compiling.
gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
Linux stoydesk 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008
i686 GNU/Linux
This is a patch based on the linux-2.6.26-rc8 kernel and it changes
the if(condition) BUG(); to the more desirable BUG_ON(condition);
diff -uprN vanila/linux-2.6.26-rc8/fs/afs/rxrpc.c devel/fs/afs/rxrpc.c
--- vanila/linux-2.6.26-rc8/fs/afs/rxrpc.c 2008-07-03
03:28:52.000000000 -0500
+++ devel/fs/afs/rxrpc.c 2008-07-03 03:31:40.000000000 -0500
@@ -139,8 +139,7 @@ static void afs_data_delivered(struct sk
} else {
_debug("DLVR %p{%u} [%d]",
skb, skb->mark, atomic_read(&afs_outstanding_skbs));
- if (atomic_dec_return(&afs_outstanding_skbs) == -1)
- BUG();
+ BUG_ON(atomic_dec_return(&afs_outstanding_skbs) == -1);
rxrpc_kernel_data_delivered(skb);
}
}
@@ -156,8 +155,7 @@ static void afs_free_skb(struct sk_buff
} else {
_debug("FREE %p{%u} [%d]",
skb, skb->mark, atomic_read(&afs_outstanding_skbs));
- if (atomic_dec_return(&afs_outstanding_skbs) == -1)
- BUG();
+ BUG_ON(atomic_dec_return(&afs_outstanding_skbs) == -1);
rxrpc_kernel_free_skb(skb);
}
}
@@ -169,8 +167,7 @@ static void afs_free_call(struct afs_cal
{
_debug("DONE %p{%s} [%d]",
call, call->type->name, atomic_read(&afs_outstanding_calls));
- if (atomic_dec_return(&afs_outstanding_calls) == -1)
- BUG();
+ BUG_ON(atomic_dec_return(&afs_outstanding_calls) == -1);
ASSERTCMP(call->rxcall, ==, NULL);
ASSERT(!work_pending(&call->async_work));
@@ -653,8 +650,7 @@ void afs_transfer_reply(struct afs_call
{
size_t len = skb->len;
- if (skb_copy_bits(skb, 0, call->buffer + call->reply_size, len) < 0)
- BUG();
+ BUG_ON(skb_copy_bits(skb, 0, call->buffer + call->reply_size, len) < 0);
call->reply_size += len;
}
@@ -720,10 +716,8 @@ static int afs_deliver_cm_op_id(struct a
/* the operation ID forms the first four bytes of the request data */
len = min_t(size_t, len, 4 - call->offset);
- if (skb_copy_bits(skb, 0, oibuf + call->offset, len) < 0)
- BUG();
- if (!pskb_pull(skb, len))
- BUG();
+ BUG_ON(skb_copy_bits(skb, 0, oibuf + call->offset, len) < 0);
+ BUG_ON(!pskb_pull(skb, len));
call->offset += len;
if (call->offset < 4) {
@@ -837,9 +831,8 @@ int afs_extract_data(struct afs_call *ca
ASSERTCMP(call->offset, <, count);
len = min_t(size_t, len, count - call->offset);
- if (skb_copy_bits(skb, 0, buf + call->offset, len) < 0 ||
- !pskb_pull(skb, len))
- BUG();
+ BUG_ON(skb_copy_bits(skb, 0, buf + call->offset, len) < 0 ||
+ !pskb_pull(skb, len));
call->offset += len;
if (call->offset < count) {
Signed-off-by: Stoyan Gaydarov <[EMAIL PROTECTED]>
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ