[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180319194126.ldamexpmw4ji7qi6@sbauer-Z170X-UD5>
Date: Mon, 19 Mar 2018 13:41:26 -0600
From: Scott Bauer <scott.bauer@...el.com>
To: Christoph Hellwig <hch@....de>
Cc: Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>,
Jonathan Derrick <jonathan.derrick@...el.com>,
Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 06/11] block: sed-opal: split generation of bytestring
header and content
On Mon, Mar 19, 2018 at 08:59:45PM +0100, Christoph Hellwig wrote:
> > +static u8 *add_bytestring_header(int *err, struct opal_dev *cmd, size_t len)
> > {
> > size_t header_len = 1;
> > bool is_short_atom = true;
> > -
> > - if (*err)
> > - return;
> > + char *start;
>
> Shouldn't this also return early if we have a pending error?
It will short circuit and bail out via can_add failing. So even though
you have to go dig to see if the following functions handle the erorr
I think it's slightly cleaner to have a single if (*err) in the deeper functions.
This lest the error back out the call chain instead of having multiple if (*err)
checks earlier in the call chains.
Powered by blists - more mailing lists