Re: [PATCH 8/8] mm/migrate.c: use break instead of goto out_flush

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

 



On Sun 19-01-20 11:06:36, Wei Yang wrote:
> Label out_flush is just outside the loop, so break the loop is enough.

I find the explicit label easier to follow than breaking out of the
loop. Especially when there is another break out of the loop with a
different label.

While the patch is correct I find the resulting code worse readable.

> Signed-off-by: Wei Yang <richardw.yang@xxxxxxxxxxxxxxx>
> ---
>  mm/migrate.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 2a857fec65b6..59bfae11b9d6 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1621,22 +1621,22 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
>  
>  		err = -EFAULT;
>  		if (get_user(p, pages + i))
> -			goto out_flush;
> +			break;
>  		if (get_user(node, nodes + i))
> -			goto out_flush;
> +			break;
>  		addr = (unsigned long)untagged_addr(p);
>  
>  		/* Check node if it is not checked. */
>  		if (current_node == NUMA_NO_NODE || node != current_node) {
>  			err = -ENODEV;
>  			if (node < 0 || node >= MAX_NUMNODES)
> -				goto out_flush;
> +				break;
>  			if (!node_state(node, N_MEMORY))
> -				goto out_flush;
> +				break;
>  
>  			err = -EACCES;
>  			if (!node_isset(node, task_nodes))
> -				goto out_flush;
> +				break;
>  		}
>  
>  		if (current_node == NUMA_NO_NODE) {
> @@ -1676,9 +1676,9 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes,
>  		 */
>  		err = store_status(status, i, err ? : current_node, 1);
>  		if (err)
> -			goto out_flush;
> +			break;
>  	}
> -out_flush:
> +
>  	/* Make sure we do not overwrite the existing error */
>  	err1 = move_pages_and_store_status(mm, current_node, &pagelist,
>  				status, start, i - start - need_move);
> -- 
> 2.17.1

-- 
Michal Hocko
SUSE Labs




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux