Kernel Newbies archive on
 help / Atom feed
* stylistically, IS_ERR() versus IS_ERR_VALUE()?
@ 2018-12-31 19:53 Robert P. J. Day
  0 siblings, 0 replies; 1+ messages in thread
From: Robert P. J. Day @ 2018-12-31 19:53 UTC (permalink / raw)
  To: Kernel Newbies

  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

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

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

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



Robert P. J. Day                                 Ottawa, Ontario, CANADA


Kernelnewbies mailing list

^ permalink raw reply	[flat|nested] 1+ messages in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-31 19:53 stylistically, IS_ERR() versus IS_ERR_VALUE()? Robert P. J. Day

Kernel Newbies archive on

Archives are clonable:
	git clone --mirror kernelnewbies/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kernelnewbies kernelnewbies/ \
	public-inbox-index kernelnewbies

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox