[9610] wlbt: Fixed number of entries computed in small banks
authorAlbert Cano <a.canocamps@samsung.com>
Mon, 30 Jul 2018 14:34:40 +0000 (15:34 +0100)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:58 +0000 (20:22 +0300)
Incorrect indexing when computing the number of
entries in small banks.

Also fixed misleading logging message

Change-Id: I9ebd7e63cc184a361e7fb74f1693173a0471f342
SCSC-Bug-Id: SSB-42388
Signed-off-by: Albert Cano <a.canocamps@samsung.com>
drivers/misc/samsung/scsc/mifsmapper.c

index 924459c3c68852ddf1645d5525fe7cc3c1a116dd..954d67f8b0dd9c386007e507f32228222dffd432 100644 (file)
@@ -143,7 +143,7 @@ int mifsmapper_alloc_bank(struct mifsmapper *smapper, bool large_bank, u32 entry
        /* Clear bank entries */
        bitmap_zero(bank[which_bit + offset].entries_bm, bank[which_bit + offset].num_entries);
 
-       *entries = bank[which_bit].mem_range_bytes/entry_size;
+       *entries = bank[which_bit + offset].mem_range_bytes/entry_size;
        /* Saturate */
        if (*entries > bank[which_bit + offset].num_entries)
                *entries = bank[which_bit + offset].num_entries;
@@ -163,7 +163,7 @@ int mifsmapper_alloc_bank(struct mifsmapper *smapper, bool large_bank, u32 entry
        bank[which_bit + offset].in_use = true;
        bank[which_bit + offset].granularity = entry_size;
 
-       SCSC_TAG_INFO(MIF, "entries %d bank[which_bit].num_entries %d large bank %d logical bank %d entries left %d\n", *entries, bank[which_bit + offset].num_entries, large_bank, which_bit + offset,
+       SCSC_TAG_INFO(MIF, "entries %d bank.num_entries %d large bank %d logical bank %d entries left %d\n", *entries, bank[which_bit + offset].num_entries, large_bank, which_bit + offset,
                        bank[which_bit + offset].num_entries_left);
 
        spin_unlock(&smapper->lock);