Re: [PATCH 1/5] SDIO: introduce API for special power management features

Andrew Morton
2010-02-11T20:33:25Z

On Tue, 09 Feb 2010 15:29:22 -0500
Nicolas Pitre <nico@fluxnic.net> wrote:

> + BUG_ON(!func);
> + BUG_ON(!func->card);
> +
> + host = func->card->host;

It's a bit redundant to check for null and then deref the pointer - the
kernel will reliably oops on the NULL deref, which gives us the same
info.

I guess the BUG_ON is more useful in the case where a double-deref is
being performed, as it can otherwise be a bit hard to work out which
pointer was NULL.