Re: [PATCH v4 03/16] block: sed-opal: unify space check in add_token_*

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

 



On Fri, Feb 01, 2019 at 09:50:10PM +0100, David Kozub wrote:
> From: Jonas Rabenstein <jonas.rabenstein@xxxxxxxxxxxxxxxxxxxxxxx>
> 
> All add_token_* functions have a common set of conditions that have to
> be checked. Use a common function for those checks in order to avoid
> different behaviour as well as code duplication.
> 
> Co-authored-by: David Kozub <zub@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jonas Rabenstein <jonas.rabenstein@xxxxxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: David Kozub <zub@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Scott Bauer <sbauer@xxxxxxxxxxxxxx>
> ---
>  block/sed-opal.c | 30 +++++++++++++++++++++---------
>  1 file changed, 21 insertions(+), 9 deletions(-)
> 
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index 5c123a5b4ab1..980705681806 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -510,15 +510,29 @@ static int opal_discovery0(struct opal_dev *dev, void *data)
>  	return opal_discovery0_end(dev);
>  }
>  
> -static void add_token_u8(int *err, struct opal_dev *cmd, u8 tok)
> +static size_t remaining_size(struct opal_dev *cmd)
> +{
> +	return IO_BUFFER_LENGTH - cmd->pos;
> +}

This function seem a little pointless to me, at least as of this patch
where it only has a single user just below.

Otherwise this looks good to me:

Reviewed-by: Christoph Hellwig <hch@xxxxxx>



[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