Messages in this thread Patch in this message | | | From | Denis Efremov <> | Subject | [PATCH v3 14/26] rapidio/tsi721: Loop using PCI_STD_NUM_BARS | Date | Mon, 16 Sep 2019 23:41:46 +0300 |
| |
Refactor loops to use idiomatic C style and avoid the fencepost error of using "i < PCI_STD_RESOURCE_END" when "i <= PCI_STD_RESOURCE_END" is required, e.g., commit 2f686f1d9bee ("PCI: Correct PCI_STD_RESOURCE_END usage").
To iterate through all possible BARs, loop conditions changed to the *number* of BARs "i < PCI_STD_NUM_BARS", instead of the index of the last valid BAR "i <= PCI_STD_RESOURCE_END".
Cc: Matt Porter <mporter@kernel.crashing.org> Cc: Alexandre Bounine <alex.bou9@gmail.com> Signed-off-by: Denis Efremov <efremov@linux.com> --- drivers/rapidio/devices/tsi721.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 125a173bed45..4dd31dd9feea 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c @@ -2755,7 +2755,7 @@ static int tsi721_probe(struct pci_dev *pdev, { int i; - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { tsi_debug(INIT, &pdev->dev, "res%d %pR", i, &pdev->resource[i]); } -- 2.21.0
| |