[char_dev] Invalid uses of cdev_add return value

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

 



I hope I'm emailing the right place. I have recently noticed that there
are many invalid uses of `cdev_add`'s return value in the kernel source.
While `cdev_add` clearly mentions that it returns a negative value on
failure, many calls to this function check the return value as a
positive value.

E.g. (/drivers/mtd/ubi/vmt.c:581)
```
err = cdev_add(&vol->cdev, dev, 1);
if (err) {
	ubi_err(ubi, "cannot add character device for volume %d, error %d",
		vol_id, err);
...
```

Also, there are a few sources who check for a negative value, `err < 0`. I
I suspect these are indeed invalid usages of the function, though I'm not sure that's why I'm contacting you.

-- 
Regards, Roi L (roeilev321_@xxxxxxxxxxx)



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux