From: Damien Le Moal > Sent: 15 February 2023 01:34 > > On 2/14/23 23:08, Rick Wertenbroek wrote: > > Previously u16 variables were used to access 32-bit registers, this > > resulted in not all of the data being read from the registers. Also > > the left shift of more than 16-bits would result in moving data out > > of the variable. Use u32 variables to access 32-bit registers > > > > Fixes: cf590b078391 ("PCI: rockchip: Add EP driver for Rockchip PCIe controller") > > Cc: stable@xxxxxxxxxxxxxxx > > Signed-off-by: Rick Wertenbroek <rick.wertenbroek@xxxxxxxxx> > > --- > > drivers/pci/controller/pcie-rockchip-ep.c | 10 +++++----- > > drivers/pci/controller/pcie-rockchip.h | 1 + > > 2 files changed, 6 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/pci/controller/pcie-rockchip-ep.c b/drivers/pci/controller/pcie-rockchip-ep.c > > index ca5b363ba..b7865a94e 100644 > > --- a/drivers/pci/controller/pcie-rockchip-ep.c > > +++ b/drivers/pci/controller/pcie-rockchip-ep.c > > @@ -292,15 +292,15 @@ static int rockchip_pcie_ep_set_msi(struct pci_epc *epc, u8 fn, u8 vfn, > > { > > struct rockchip_pcie_ep *ep = epc_get_drvdata(epc); > > struct rockchip_pcie *rockchip = &ep->rockchip; > > - u16 flags; > > + u32 flags; > > > > flags = rockchip_pcie_read(rockchip, > > ROCKCHIP_PCIE_EP_FUNC_BASE(fn) + > > ROCKCHIP_PCIE_EP_MSI_CTRL_REG); > > flags &= ~ROCKCHIP_PCIE_EP_MSI_CTRL_MMC_MASK; > > flags |= > > - ((multi_msg_cap << 1) << ROCKCHIP_PCIE_EP_MSI_CTRL_MMC_OFFSET) | > > - PCI_MSI_FLAGS_64BIT; > > + (multi_msg_cap << ROCKCHIP_PCIE_EP_MSI_CTRL_MMC_OFFSET) | > > ROCKCHIP_PCIE_EP_MSI_CTRL_MMC_OFFSET is 17 and multi_msg_cap is a u8... > Not nice. It really doesn't matter. As soon as you do any arithmetic char and short are promoted to int. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)