Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Mar 2014 09:08:12 -0600
From:      Ian Lepore <ian@FreeBSD.org>
To:        Warner Losh <imp@bsdimp.com>
Cc:        freebsd-hackers@FreeBSD.org, Luiz Otavio O Souza <lists.br@gmail.com>
Subject:   Re: [RFC] lm75 kernel driver and bsnmp module
Message-ID:  <1395932892.81853.96.camel@revolution.hippie.lan>
In-Reply-To: <4B0E494C-A289-435C-89AA-29DEB1A4EAD9@gmail.com>
References:  <CAB=2f8wqTqQekBPRGdG%2BBqTn-yt1BX-3DW6K5HBt2jptc4g4-g@mail.gmail.com> <4B0E494C-A289-435C-89AA-29DEB1A4EAD9@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

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@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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1395932892.81853.96.camel>