linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Dev Jain <dev.jain@arm.com>
Cc: akpm@linux-foundation.org, richard.weiyang@gmail.com,
	maple-tree@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] maple tree: Use goto label to simplify code
Date: Tue, 24 Jun 2025 11:36:47 -0400	[thread overview]
Message-ID: <qzqzj2qhiavjaklwscit3vjmxozbigq7bpgglwejfjpx6vlwjl@y44d47g37x4b> (raw)
In-Reply-To: <20250624080748.4855-1-dev.jain@arm.com>

* Dev Jain <dev.jain@arm.com> [250624 04:08]:
> Use the underflow goto label to set the status to ma_underflow and return
> NULL, as is being done elsewhere.

Thanks for this, but the stacking of labels is unpleasant to read.

A new line like I've added makes it a bit better.  It's more my fault
having the existing code as it is.

> 
> Signed-off-by: Dev Jain <dev.jain@arm.com>
> ---
>  lib/maple_tree.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 00524e55a21e..25cf2bc607ca 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4565,11 +4565,8 @@ static void *mas_prev_slot(struct ma_state *mas, unsigned long min, bool empty)
>  		return entry;
>  
>  	if (!empty) {
> -		if (mas->index <= min) {
> -			mas->status = ma_underflow;
> -			return NULL;
> -		}
> -
> +		if (mas->index <= min)
> +			goto underflow;

>  		goto again;
>  	}

Andrew, can you just add a new line like I have above?

Reviewed-by: Liam R. Howlett <Liam.Howlett@oracle.com>

Thanks,
Liam


  reply	other threads:[~2025-06-24 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24  8:07 Dev Jain
2025-06-24 15:36 ` Liam R. Howlett [this message]
2025-06-25  7:56 ` Wei Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=qzqzj2qhiavjaklwscit3vjmxozbigq7bpgglwejfjpx6vlwjl@y44d47g37x4b \
    --to=liam.howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dev.jain@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=richard.weiyang@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox