oops! yeah ur right! overlooked the short-circuit thing for an OR condition. Thanks and sorry to have bothered u all with this trivial stuff. though what wud be the answer to my first question regarding the usage of "pci_request_regions". if i don't use it in the driver wud things still work??? -mandeep On Thu, 2004-10-07 at 17:26, Thekkedath, Gopakumar wrote: > >the code in question is > > >p = &root->child; > >for (;;) { > >> tmp = *p; << > > if (!tmp || tmp->start > end) { > ... > ... > > >the line "tmp = *p" essentially translates to "tmp = *&root->child" > >or "tmp = root->child"....so i think tmp will have a NULL val. > > >then won't the "if" condition where tmp's member is being accessed > >"tmp->start" give a prob. (null pointer derefernce)??? > > if tmp == NULL, then !tmp in non zero , since the condition is 'or' > the control will not proceed to > 'tmp->start > end'. > > > > > On Thu, 2004-10-07 at 16:43, Thekkedath, Gopakumar wrote: > > >struct resource *tmp, **p; > > ... > > >p = &root->child; > > > > >child member of root is NULL right??? cos it was'nt initialized > > >to any specfic val (so it wud have the default val. of NULL). > > > > > > As this is > > &root->child and not > > root->child, 'p' wont be NULL but the address of child -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/