Coding style quesion

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

 



HI !

 Stumbled across the somewhat inconsistent treatement of functions returning ERR_PTR()
 in the kernel with respect to coding style, while trying to write some static code 
 checks. The two forms which seem comon are:

                if (PTR_ERR(var) == -EINVAL) {
 and
                if (var == ERR_PTR(-EINVAL)) {

 of which I think the first is the intended construct.

 my understanding of ERR_PTR is that it is intended to be used in the form

                ret = ERR_PTR(-EINVAL);
                ...
                retrurn ret;
 or
                return ERR_PTR(-EINVAL);

 but not as in the second if() above - technically its the same thing
 Is there an "official" preference to the one or other form ? 

thx!
hofrat

_______________________________________________
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