Re: Is `IS_ERR_VALUE` indicates that the return value is invalid?

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

 



On Wed, Nov 20, 2013 at 5:12 PM, Anand Moon <moon.linux@xxxxxxxxx> wrote:
> Hi
>
> Please find the example to user file open in kernel below.  source file
> #linux/sound/sound_firmware.c
>
> struct file* filp;
>
> filp = filp_open(fn, 0, 0);
> if (IS_ERR(filp))
> {
>         printk(KERN_INFO "Unable to load '%s'.\n", fn);
>         return 0;
> }
>
> IS_ERR expand to below example.
>
> #define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)

IMHO, IS_ERR is a check to make sure that error number is not greater
that maximum error number defined, in other word, is it still valid or
not.


Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://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