Re: [PATCH] drivers: virtio: Use PTR_RET function

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

 



Andru Gheorghiu <gheorghiuandru@xxxxxxxxx> writes:
> PTR_RET does return. It's perfectly equivalent to using IS_ERR and the
> returning PTR_ERR. The implementation is here [1].

Um, I read the implementation, thanks.

> The reason for using it is this: if you have a function that does
> something why not call it instead of reproducing it's behavior by
> explicitly writing what it does.

Because clarity matters, and this function makes callers less clear.
It's the most breathtakingly bad name since BUILD_BUG_ON_ZERO().

Why not change PTR_ERR to return 0 if !IS_ERR()?  Noone breaks, gcc
probably produces the same code, and noone needs to learn your weird
new kernel meme.

In fact, as gcc will produce the same code for "if (PTR_ERR(p))" as it
does for "if (IS_ERR(p))", you get to be one of the very, very few
people who have ever *reduced* the complexity of a kernel interface.

Cheers,
Rusty.
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux