linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] maple_tree: modified return type of mas_wr_store_entry()
@ 2024-06-04 15:06 Jung-JaeJoon
  2024-06-05 16:40 ` Liam R. Howlett
  0 siblings, 1 reply; 2+ messages in thread
From: Jung-JaeJoon @ 2024-06-04 15:06 UTC (permalink / raw)
  To: Liam R. Howlett; +Cc: Jung-JaeJoon, maple-tree, linux-mm, linux-kernel

From: Jung-JaeJoon <rgbi3307@gmail.com>

Since the return value of mas_wr_store_entry() is not used,
the return type can be changed to void

Signed-off-by: JaeJoon Jung <rgbi3307@gmail.com>
---
 lib/maple_tree.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 2d7d27e6ae3c..da30977aab0f 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4203,31 +4203,28 @@ static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
  *
  * Return: The contents that was stored at the index.
  */
-static inline void *mas_wr_store_entry(struct ma_wr_state *wr_mas)
+static inline void mas_wr_store_entry(struct ma_wr_state *wr_mas)
 {
 	struct ma_state *mas = wr_mas->mas;
 
 	wr_mas->content = mas_start(mas);
 	if (mas_is_none(mas) || mas_is_ptr(mas)) {
 		mas_store_root(mas, wr_mas->entry);
-		return wr_mas->content;
+		return;
 	}
 
 	if (unlikely(!mas_wr_walk(wr_mas))) {
 		mas_wr_spanning_store(wr_mas);
-		return wr_mas->content;
+		return;
 	}
 
 	/* At this point, we are at the leaf node that needs to be altered. */
 	mas_wr_end_piv(wr_mas);
 	/* New root for a single pointer */
-	if (unlikely(!mas->index && mas->last == ULONG_MAX)) {
+	if (unlikely(!mas->index && mas->last == ULONG_MAX))
 		mas_new_root(mas, wr_mas->entry);
-		return wr_mas->content;
-	}
-
-	mas_wr_modify(wr_mas);
-	return wr_mas->content;
+        else
+	        mas_wr_modify(wr_mas);
 }
 
 /**
-- 
2.17.1



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] maple_tree: modified return type of mas_wr_store_entry()
  2024-06-04 15:06 [PATCH v2] maple_tree: modified return type of mas_wr_store_entry() Jung-JaeJoon
@ 2024-06-05 16:40 ` Liam R. Howlett
  0 siblings, 0 replies; 2+ messages in thread
From: Liam R. Howlett @ 2024-06-05 16:40 UTC (permalink / raw)
  To: Jung-JaeJoon; +Cc: maple-tree, linux-mm, linux-kernel

* Jung-JaeJoon <rgbi3307@gmail.com> [240604 11:07]:
> From: Jung-JaeJoon <rgbi3307@gmail.com>
> 
> Since the return value of mas_wr_store_entry() is not used,
> the return type can be changed to void
> 
> Signed-off-by: JaeJoon Jung <rgbi3307@gmail.com>
> ---
>  lib/maple_tree.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 2d7d27e6ae3c..da30977aab0f 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -4203,31 +4203,28 @@ static inline void mas_wr_modify(struct ma_wr_state *wr_mas)
>   *
>   * Return: The contents that was stored at the index.
>   */
> -static inline void *mas_wr_store_entry(struct ma_wr_state *wr_mas)
> +static inline void mas_wr_store_entry(struct ma_wr_state *wr_mas)
>  {
>  	struct ma_state *mas = wr_mas->mas;
>  
>  	wr_mas->content = mas_start(mas);
>  	if (mas_is_none(mas) || mas_is_ptr(mas)) {
>  		mas_store_root(mas, wr_mas->entry);
> -		return wr_mas->content;
> +		return;
>  	}
>  
>  	if (unlikely(!mas_wr_walk(wr_mas))) {
>  		mas_wr_spanning_store(wr_mas);
> -		return wr_mas->content;
> +		return;
>  	}
>  
>  	/* At this point, we are at the leaf node that needs to be altered. */
>  	mas_wr_end_piv(wr_mas);
>  	/* New root for a single pointer */
> -	if (unlikely(!mas->index && mas->last == ULONG_MAX)) {
> +	if (unlikely(!mas->index && mas->last == ULONG_MAX))
>  		mas_new_root(mas, wr_mas->entry);
> -		return wr_mas->content;
> -	}
> -
> -	mas_wr_modify(wr_mas);
> -	return wr_mas->content;
> +        else
> +	        mas_wr_modify(wr_mas);

These two lines have whitespace errors, you should be using tabs.
Please use scripts/checkpatch.pl to detect formatting issues like this.

>  }
>  
>  /**
> -- 
> 2.17.1
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-06-05 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-04 15:06 [PATCH v2] maple_tree: modified return type of mas_wr_store_entry() Jung-JaeJoon
2024-06-05 16:40 ` Liam R. Howlett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox