Re: [PATCH] s390/vmem: Use swap() instead of open coding it

From: Heiko Carstens
Date: Tue Jan 17 2023 - 03:45:18 EST


On Tue, Jan 17, 2023 at 02:02:23PM +0800, Jiapeng Chong wrote:
> Swap is a function interface that provides exchange function. To avoid
> code duplication, we can use swap function.
>
> ./arch/s390/mm/vmem.c:680:10-11: WARNING opportunity for swap().
>
> Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3786
> Reported-by: Abaci Robot <abaci@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@xxxxxxxxxxxxxxxxx>
> ---
> arch/s390/mm/vmem.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/s390/mm/vmem.c b/arch/s390/mm/vmem.c
> index 78d7768f93d7..774a71b94f5c 100644
> --- a/arch/s390/mm/vmem.c
> +++ b/arch/s390/mm/vmem.c
> @@ -674,11 +674,8 @@ static void __init memblock_region_swap(void *a, void *b, int size)
> {
> struct memblock_region *r1 = a;
> struct memblock_region *r2 = b;
> - struct memblock_region swap;
>
> - swap = *r1;
> - *r1 = *r2;
> - *r2 = swap;
> + swap(*r1, *r2);
> }

Let's remove r1, and r2 as well. I applied the below: