svn commit: r230125 - head/sys/kern

Scott Long scottl at samsco.org
Tue Jan 17 19:44:31 UTC 2012


On Jan 17, 2012, at 8:08 AM, John Baldwin wrote:
> On Sunday, January 15, 2012 6:32:43 pm Colin Percival wrote:
>> On 01/15/12 15:28, John Baldwin wrote:
>>> On 1/15/12 2:09 AM, Eitan Adler wrote:
>>>> Log:
>>>>  - Fix undefined behavior when device_get_name is null
>>>>  - Make error message more informative
>>> 
>>> The in-kernel printf(9) always prints "(null)" for %s when the pointer is NULL,
>>> so that wasn't undefined behavior.  Printing out the driver name is a useful
>>> change, but the "(unknown)" bits are just noise as it isn't clear that
>>> "(unknown)" is substantially better than "(null)".
>> 
>> I think the change from "(null)" to "(unknown)" is useful, since when I see
>> "(null)" printed my immediate thought is "looks like there's a bug I need to
>> track down here".
> 
> The entire printf is "there's a bug I need to track down here".  (null)
> explicitly tells me that device_get_name() is NULL when looking at the printf
> to see what it means.  Having it be (unknown) tells me the same exact thing,
> but only after I've parsed an extra 2-3 lines of code to figure out what
> (unknown) stands for.
> 

I like that change.  "null" is ambiguous for those who aren't intimately familiar with the bus code.

Scott




More information about the svn-src-all mailing list