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

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

 



On Thu, Jan 31, 2019 at 3:31 PM Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> On Thu, 2019-01-31 at 14:13 -0800, Evan Green wrote:
> > diff --git a/drivers/block/loop.c b/drivers/block/loop.c
> > index cf5538942834..a1ba555e3b92 100644
> > --- a/drivers/block/loop.c
> > +++ b/drivers/block/loop.c
> > @@ -458,8 +458,13 @@ static void lo_complete_rq(struct request *rq)
> >
> >       if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
> >           req_op(rq) != REQ_OP_READ) {
> > -             if (cmd->ret < 0)
> > -                     ret = BLK_STS_IOERR;
> > +             if (cmd->ret < 0) {
> > +                     if (cmd->ret == -EOPNOTSUPP)
> > +                             ret = BLK_STS_NOTSUPP;
> > +                     else
> > +                             ret = BLK_STS_IOERR;
> > +             }
>
> 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->ret == -ENOTSUPP)
>         ret = BLK_STS_NOTSUPP;
> else if (cmd->ret < 0)
>         ret = BLK_STS_IOERR;
>

Thanks for taking a look Bart. Will fix.
-Evan



[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