Return value for "impossible" situations

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

 



In user space, I use assertions to check (and document) the assumptions
built in to my code - this value won't ever be negative, this int will
only ever by one of these 3 values, etc.

For kernel code, I can use pr_err, dump_stack, WARN_ON, etc. to report
the issue in the log, but I often also need to return some sort of error
code (negative errno value).

Is there any sort of convention around what to return in the case of an
error in the logic of the code itself, something that will make it as
obvious as possible that the problem is a bug.

TIA!

--
========================================================================
                 In Soviet Russia, Google searches you!
========================================================================


_______________________________________________
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