diff options
-rw-r--r-- | drivers/ntb/ntb_hw.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/ntb/ntb_hw.c b/drivers/ntb/ntb_hw.c index f802e7c92356..195cc51ffbf6 100644 --- a/drivers/ntb/ntb_hw.c +++ b/drivers/ntb/ntb_hw.c | |||
@@ -345,7 +345,7 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val) | |||
345 | */ | 345 | */ |
346 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) | 346 | void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) |
347 | { | 347 | { |
348 | if (mw > NTB_NUM_MW) | 348 | if (mw >= NTB_NUM_MW) |
349 | return NULL; | 349 | return NULL; |
350 | 350 | ||
351 | return ndev->mw[mw].vbase; | 351 | return ndev->mw[mw].vbase; |
@@ -362,7 +362,7 @@ void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw) | |||
362 | */ | 362 | */ |
363 | resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) | 363 | resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) |
364 | { | 364 | { |
365 | if (mw > NTB_NUM_MW) | 365 | if (mw >= NTB_NUM_MW) |
366 | return 0; | 366 | return 0; |
367 | 367 | ||
368 | return ndev->mw[mw].bar_sz; | 368 | return ndev->mw[mw].bar_sz; |
@@ -380,7 +380,7 @@ resource_size_t ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw) | |||
380 | */ | 380 | */ |
381 | void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) | 381 | void ntb_set_mw_addr(struct ntb_device *ndev, unsigned int mw, u64 addr) |
382 | { | 382 | { |
383 | if (mw > NTB_NUM_MW) | 383 | if (mw >= NTB_NUM_MW) |
384 | return; | 384 | return; |
385 | 385 | ||
386 | dev_dbg(&ndev->pdev->dev, "Writing addr %Lx to BAR %d\n", addr, | 386 | dev_dbg(&ndev->pdev->dev, "Writing addr %Lx to BAR %d\n", addr, |