[PATCH 0/2] staging: dgnc: fix return error codes

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

 



Review of a previously merged patch made a few comments that required
investigating.

Some function call errors were not being preserved across the function
call chain.

It was found that driver code was non-uniform in its use of error
return codes, identical failures are returning different error
codes. Return is on failure when checking struct magic numbers. Error
codes used include -ENODEV, -ENXIO, -EIO, and -EFAULT.

It was decided to use -ENXIO. Justification is that usual call
includes a check that the struct is non-NULL OR'd with check on the
magic number.

#define ENXIO 6 /* No such device or address */

Seems like a good fit. Also this choice results in the minimum number
of files touched.

Patch 01 fixes the error return codes.

Patch 02 preserves error code across function calls.

Code has not been tested. Builds on x86_64 and PowerPC. Checked with
checkpatch --strict, Smatch, and Sparse. Series does not introduce any
new warnings.

Tobin C. Harding (2):
  staging: dgnc: make error codes uniform
  staging: dgnc: preserve return code

 drivers/staging/dgnc/dgnc_mgmt.c |  2 +-
 drivers/staging/dgnc/dgnc_tty.c  | 50 ++++++++++++++++++++--------------------
 2 files changed, 26 insertions(+), 26 deletions(-)

-- 
2.7.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux