stylistically, IS_ERR() versus IS_ERR_VALUE()?

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

 



  poking around error handling in the kernel, and noticed the
following ... in include/linux/err.h, we have IS_ERR() unsurprisingly
defined in terms of IS_ERR_VALUE():

  #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= \
    (unsigned long)-MAX_ERRNO)

  ... snip ...

  static inline bool __must_check IS_ERR(__force const void *ptr)
  {
        return IS_ERR_VALUE((unsigned long)ptr);
  }

fair enough, and the above suggests that it's technically equivalent
to use either one, but if i search under drivers/ for each:

  $ git grep -w IS_ERR -- drivers | wc -l
  14048
  $

  $ git grep -w IS_ERR_VALUE -- drivers | wc -l
  48
  $

so IS_ERR() is pretty clearly the call of choice, and the invocations
of IS_ERR_VALUE() are concentrated in a small number of files -- heck,
15 of those calls are in the single file
drivers/net/ethernet/freescale/ucc_geth.c.

  is there any non-obvious reason for driver code to use the latter?
superficially, they *seem* to be equivalent, but i've been surprised
before.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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