[RFC] lm75 kernel driver and bsnmp module

Ian Lepore ian at FreeBSD.org
Thu Mar 27 15:08:16 UTC 2014


On Tue, 2014-03-18 at 08:26 -0600, Warner Losh wrote:
> On Mar 17, 2014, at 8:11 AM, Luiz Otavio O Souza <lists.br at gmail.com> wrote:
> [...]
> +	sc->sc_hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data;
> 
> I don’t think that the NULL binding is guaranteed to work that way, so
> I’d suggest dropping the NULL line above and testing explicitly for NULL
> here instead.

I missed this comment when it first flew by...

I specifically wrote ofw_bus_search_compatible() to never return NULL so
that we didn't have identical NULL-check-then-returned-value-check code
in every driver.  It always returns a pointer to a table entry, and if
that entry is the table terminator (NULL compat string) then it returns
the driver-chosen data value associated with that terminator entry.

-- Ian




More information about the freebsd-hackers mailing list