aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-01-28 23:32:13 +0200
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-02-10 17:47:38 +0200
commit45e21277f94753c3e3429e63e5785888ee1ead4a (patch)
tree545132018b077bc64be6f42d97e2cd59a31b5bd8
parentplatform/x86: dell_rbu: don't open code list_for_each_entry*() (diff)
downloadlinux-dev-45e21277f94753c3e3429e63e5785888ee1ead4a.tar.xz
linux-dev-45e21277f94753c3e3429e63e5785888ee1ead4a.zip
platform/x86: dell_rbu: Simplify cleanup code in create_packet()
The code looks more nicer if we use: while (idx--) instead: for (;idx>0;idx--) Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/platform/x86/dell_rbu.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/platform/x86/dell_rbu.c b/drivers/platform/x86/dell_rbu.c
index 4e044fc60b1e..416a7db9966a 100644
--- a/drivers/platform/x86/dell_rbu.c
+++ b/drivers/platform/x86/dell_rbu.c
@@ -199,12 +199,10 @@ static int create_packet(void *data, size_t length)
out_alloc_packet_array:
/* always free packet array */
- for (;idx>0;idx--) {
+ while (idx--) {
pr_debug("freeing unused packet below floor 0x%lx.\n",
- (unsigned long)virt_to_phys(
- invalid_addr_packet_array[idx-1]));
- free_pages((unsigned long)invalid_addr_packet_array[idx-1],
- ordernum);
+ (unsigned long)virt_to_phys(invalid_addr_packet_array[idx]));
+ free_pages((unsigned long)invalid_addr_packet_array[idx], ordernum);
}
kfree(invalid_addr_packet_array);