Re: [RESEND PATCH 1/2] loop: Report EOPNOTSUPP properly

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

 



On Thu, 2019-01-31 at 14:13 -0800, Evan Green wrote:
+AD4 diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+AD4 index cf5538942834..a1ba555e3b92 100644
+AD4 --- a/drivers/block/loop.c
+AD4 +-+-+- b/drivers/block/loop.c
+AD4 +AEAAQA -458,8 +-458,13 +AEAAQA static void lo+AF8-complete+AF8-rq(struct request +ACo-rq)
+AD4  
+AD4  	if (+ACE-cmd-+AD4-use+AF8-aio +AHwAfA cmd-+AD4-ret +ADw 0 +AHwAfA cmd-+AD4-ret +AD0APQ blk+AF8-rq+AF8-bytes(rq) +AHwAfA
+AD4  	    req+AF8-op(rq) +ACEAPQ REQ+AF8-OP+AF8-READ) +AHs
+AD4 -		if (cmd-+AD4-ret +ADw 0)
+AD4 -			ret +AD0 BLK+AF8-STS+AF8-IOERR+ADs
+AD4 +-		if (cmd-+AD4-ret +ADw 0) +AHs
+AD4 +-			if (cmd-+AD4-ret +AD0APQ -EOPNOTSUPP)
+AD4 +-				ret +AD0 BLK+AF8-STS+AF8-NOTSUPP+ADs
+AD4 +-			else
+AD4 +-				ret +AD0 BLK+AF8-STS+AF8-IOERR+ADs
+AD4 +-		+AH0

Please do not nest if-conditions if that is not necessary. I think the
above code can be written more clearly as follows:

if (cmd-+AD4-ret +AD0APQ -ENOTSUPP)
	ret +AD0 BLK+AF8-STS+AF8-NOTSUPP+ADs
else if (cmd-+AD4-ret +ADw 0)
	ret +AD0 BLK+AF8-STS+AF8-IOERR+ADs

Thanks,

Bart.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux