lkml.org 
[lkml]   [2009]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] printk: Let %pR handle NULL pointers
On Sun, 4 Jan 2009, Benjamin Herrenschmidt wrote:
> > I thought of doing that too, but then all the various %pX formats would all
> > have to print the same for NULL pointers. For instance a resource prints
> > out like "[0x1000-0x100f]", so I chose "[NULL]" for printing a null
> > resource pointer. Maybe "[]" or "[-]" would be better? A null MAC address
> > could be ":::::" or "x:x:x:x:x:x". "N.U.L.L" or "x.x.x.x" for a null IP4
> > address. And so on. So the printout looks nicer when a NULL pointer isn't
> > a bug.
>
> And how often is that ?

For resource pointers it's not uncommon. There are many cases when it's perfectly
ok for a resource pointer to be null, e.g. res->parent is often null, pci devices
and busses don't usually have all possible ranges, etc. It nice to get decent info
printouts without having the check for NULL pointers.


\
 
 \ /
  Last update: 2009-01-04 21:45    [W:0.062 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site