Skip to content

Commit 4644db8

Browse files
Hans Zhangbjorn-helgaas
authored andcommitted
misc: pci_endpoint_test: Remove redundant 'remainder' test
A BAR size is always a power of two. buf_size = min(SZ_1M, bar_size). If the BAR size is <= 1MB, there will be one iteration, no remainder. If the BAR size is > 1MB, there will be more than one iteration, but the size will always be evenly divisible by 1MB, so no remainder. Link: https://lore.kernel.org/r/[email protected] Suggested-by: Niklas Cassel <[email protected]> Signed-off-by: Hans Zhang <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Niklas Cassel <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]>
1 parent d6658d3 commit 4644db8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/misc/pci_endpoint_test.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ static int pci_endpoint_test_bar_memcmp(struct pci_endpoint_test *test,
283283
static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
284284
enum pci_barno barno)
285285
{
286-
int j, bar_size, buf_size, iters, remain;
286+
int j, bar_size, buf_size, iters;
287287
void *write_buf __free(kfree) = NULL;
288288
void *read_buf __free(kfree) = NULL;
289289
struct pci_dev *pdev = test->pdev;
@@ -316,12 +316,6 @@ static bool pci_endpoint_test_bar(struct pci_endpoint_test *test,
316316
write_buf, read_buf, buf_size))
317317
return false;
318318

319-
remain = bar_size % buf_size;
320-
if (remain)
321-
if (pci_endpoint_test_bar_memcmp(test, barno, buf_size * iters,
322-
write_buf, read_buf, remain))
323-
return false;
324-
325319
return true;
326320
}
327321

0 commit comments

Comments
 (0)