Skip to content

Commit

Permalink
PCI: rcar: Fix calculating mask for PCIEPAMR register
Browse files Browse the repository at this point in the history
The mask value was calculated incorrectly for PCIEPAMR register if the
size was less than 128 bytes. Fix this issue by adding a check on size.

Link: https://lore.kernel.org/r/1588854799-13710-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
  • Loading branch information
Lad Prabhakar authored and Lorenzo Pieralisi committed May 11, 2020
1 parent 78a0d7f commit 3282636
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/pci/controller/pcie-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ void rcar_pcie_set_outbound(struct rcar_pcie *pcie, int win,
* keeps things pretty simple.
*/
size = resource_size(res);
mask = (roundup_pow_of_two(size) / SZ_128) - 1;
if (size > 128)
mask = (roundup_pow_of_two(size) / SZ_128) - 1;
else
mask = 0x0;
rcar_pci_write_reg(pcie, mask << 7, PCIEPAMR(win));

if (res->flags & IORESOURCE_IO)
Expand Down

0 comments on commit 3282636

Please sign in to comment.