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

From: David Brownell
Date: Thu Aug 21 2008 - 14:29:40 EST


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.

- Dave
--
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/