Re: [PATCH 06/15] driver model: anti-oopsing medicine

From: Greg KH
Date: Thu Aug 21 2008 - 16:07:51 EST


On Thu, Aug 21, 2008 at 11:24:22AM -0700, David Brownell wrote:
> On Thursday 21 August 2008, Greg Kroah-Hartman wrote:
> > +       if (!class->p) {
> > +               WARN(1, "%s called for class '%s' before it was initialized",
> > +                    __func__, class->name);
> > +               return -EINVAL;
> > +       }
>
> Or -- for future reference -- using WARN() with non-constant
> initial parameter:
>
> if (WARN(!class-p, "%s called ...\n" ...))
> return -EINVAL;
>
> Some of those macros now have return values, supportin C code
> that looks a bit more compact.

Ah, yeah, that looks much nicer, I'll remember that in the future.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/