diff mbox series

parisc: using swap() instead of tmp

Message ID 20211101021047.22945-1-hanyihao@vivo.com (mailing list archive)
State Superseded
Headers show
Series parisc: using swap() instead of tmp | expand

Commit Message

Yihao Han Nov. 1, 2021, 2:10 a.m. UTC
swap() was used instead of the tmp variable to swap values

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 arch/parisc/mm/init.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Matthew Wilcox Nov. 1, 2021, 2:21 a.m. UTC | #1
On Sun, Oct 31, 2021 at 07:10:45PM -0700, Yihao Han wrote:
> @@ -127,16 +127,13 @@ static void __init setup_bootmem(void)
>  		int j;
>  
>  		for (j = i; j > 0; j--) {
> -			physmem_range_t tmp;
>  

If you're going to delete that line, you should also delete the
blank line after it.

>  			if (pmem_ranges[j-1].start_pfn <
>  			    pmem_ranges[j].start_pfn) {
>  
>  				break;
>  			}
> -			tmp = pmem_ranges[j-1];
> -			pmem_ranges[j-1] = pmem_ranges[j];
> -			pmem_ranges[j] = tmp;
> +			swap(pmem_ranges[j-1], pmem_ranges[j]);
>  		}
>  	}
>  
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 65f50f072a87..b705a423be85 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -127,16 +127,13 @@  static void __init setup_bootmem(void)
 		int j;
 
 		for (j = i; j > 0; j--) {
-			physmem_range_t tmp;
 
 			if (pmem_ranges[j-1].start_pfn <
 			    pmem_ranges[j].start_pfn) {
 
 				break;
 			}
-			tmp = pmem_ranges[j-1];
-			pmem_ranges[j-1] = pmem_ranges[j];
-			pmem_ranges[j] = tmp;
+			swap(pmem_ranges[j-1], pmem_ranges[j]);
 		}
 	}