lkml.org 
[lkml]   [2010]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    SubjectRe: [PATCH 1/1] omap: Ptr "isr_reg" tracked as NULL was dereferenced
    Date
    Felipe Balbi <balbi@ti.com> writes:

    > Hi,
    >
    > On Tue, Oct 05, 2010 at 03:42:10AM -0500, Evgeny Kuznetsov wrote:
    >>+ if (!isr_reg) {
    >>+ printk(KERN_ERR "FATAL: Incorrect GPIO method %i\n",
    >>+ bank->method);
    >>+ BUG();
    >>+ }
    >
    > this could be simply:
    >
    > BUG_ON(!isr_reg);

    WARN_ON is better.

    A BUG() will panic the kernel and stop everything. This is not an error
    condition that should prevent the entire kernel from running.

    From asm-generic/bug.h:

    /*
    * Don't use BUG() or BUG_ON() unless there's really no way out; one
    * example might be detecting data structure corruption in the middle
    * of an operation that can't be backed out of. If the (sub)system
    * can somehow continue operating, perhaps with reduced functionality,
    * it's probably not BUG-worthy.
    *
    * If you're tempted to BUG(), think again: is completely giving up
    * really the *only* solution? There are usually better options, where
    * users don't need to reboot ASAP and can mostly shut down cleanly.
    */


    \
     
     \ /
      Last update: 2010-10-05 17:03    [W:0.030 / U:181.844 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site