Skip to contentSkip to conversation

staging: android: ion: remove unnecessary intermediate variable 'objs'

PATCH In review Valery Ivanov 2 participants 2 messages Aug 27, 2020 – Aug 28, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: ion: remove unnecessary intermediate variable 'objs'

It is not necesssary to use 'objs' as an intermediate variable for assignment operation.

---
 drivers/staging/android/ion/ion.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/android/ion/ion.c +2 -5
index 3c9f09506ffa..137bef25dcbc 100644
@@ -523,15 +523,12 @@ static int debug_shrink_set(void *data, u64 val)
 {
 	struct ion_heap *heap = data;
 	struct shrink_control sc;
-	int objs;
 
 	sc.gfp_mask = GFP_HIGHUSER;
 	sc.nr_to_scan = val;
 
-	if (!val) {
-		objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
-		sc.nr_to_scan = objs;
-	}
+	if (!val)
+		sc.nr_to_scan = heap->shrinker.count_objects(&heap->shrinker, &sc);
 
 	heap->shrinker.scan_objects(&heap->shrinker, &sc);
 	return 0;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 32 lines · Valery Ivanov

It is not necesssary to use 'objs' as an intermediate variable for assignment operation.

---
 drivers/staging/android/ion/ion.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/android/ion/ion.c +2 -5
index 3c9f09506ffa..137bef25dcbc 100644
@@ -523,15 +523,12 @@ static int debug_shrink_set(void *data, u64 val)
 {
 	struct ion_heap *heap = data;
 	struct shrink_control sc;
-	int objs;
 
 	sc.gfp_mask = GFP_HIGHUSER;
 	sc.nr_to_scan = val;
 
-	if (!val) {
-		objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
-		sc.nr_to_scan = objs;
-	}
+	if (!val)
+		sc.nr_to_scan = heap->shrinker.count_objects(&heap->shrinker, &sc);
 
 	heap->shrinker.scan_objects(&heap->shrinker, &sc);
 	return 0;
Signature · 1 line
2.25.1

Please use scripts/get_maintainer.pl to determine who and what mailing list to send patches to. You missed the actual maintainers of this code.

thanks,

greg k-h