Subject: Re: [Patch] Micrel KS8695 intergrated ethernet driver

From: Kalle Valo <[email-masked]>
Date: Sat, 13 Dec 2008 21:07:25 +0200

Daniel Silverstone <[email-masked]> writes:

>> > +       if (ksp->tx_buffers[buff_n].skb) {
>> > +               /* This slot is used, try later */
>> > +               spin_unlock_irq(&ksp->txq_lock);
>> > +               return -EAGAIN;
>> Since you already tested tx_ring_used, wouldn't this indicate a bug?
>
> Yep, this was old code before I kept a track in tx_ring_used. Changed
> to:
>
> BUG_ON(ksp->tx_buffers[buff_n].skb);

I would say that a network driver should never use BUG_ON(), it just
makes both user's and developer's life difficult because the whole
kernel will stop the execution. WARN_ON() is much nicer, it just
prints a nice warning to the log which then can be reported either
manually or automatically.

-- 
Kalle Valo