Re: [PATCH v2 06/11] block: sed-opal: split generation of bytestring header and content

From: Scott Bauer
Date: Mon Mar 19 2018 - 16:07:19 EST


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.