Re: ERR_PTR and PTR_ERR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2007-03-16 at 09:36 -0400, Ming Zhang wrote:
> On Thu, 2007-03-15 at 20:21 -0700, Randy Dunlap wrote:
> > On Mon, 12 Mar 2007 13:23:07 -0400 Ming Zhang wrote:
> > 
> > > Hi All
> > > 
> > > I know sometime we need ERR_PTR and PTR_ERR, but why we need to write
> > > code like this line 356 in quotactl_block()
> > > 
> > > 353         bdev = lookup_bdev(tmp);
> > > 354         putname(tmp);
> > > 355         if (IS_ERR(bdev))
> > > 356                 return ERR_PTR(PTR_ERR(bdev))
> > > 
> > > instead of 
> > > 
> > > 	return bdev
> > > 
> > > it convert a PTR to ERR and then back to PTR. any idea why?
> > 
> > Did you test what happens when you change that return line to be only
> > 			return bdev;
> > ?  Please do so.
> 
> sorry i should be more accurate.
> 
> ERR_PTR(PTR_ERR(bdev)) is like to 
> 
> return (void *)(long)bdev; 
> 
> then what is the difference between this and 
> 
> return (void *)bdev;
> 
> 
> from speed, this 2 should have no difference. then any other
> consideration?

This is a very good question, and I am curious about the answer.  I was
hoping that you would get an answer.  Can you do Randy's suggestion, and
change "ERR_PTR(PTR_ERR(bdev))" to "bdev", and see if it breaks?

Thanks,
Avishay


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux