Re: [PATCH] PCI: tegra: Fix shiftTooManyBitsSigned warning for Tegra194

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 18/06/2021 17:02, Jon Hunter wrote:
> The cppcheck tool issues the following warning for the Tegra194 PCIe
> driver ...
> 
>  $ cppcheck --enable=all drivers/pci/controller/dwc/pcie-tegra194.c
>  Checking drivers/pci/controller/dwc/pcie-tegra194.c ...
> 
>  drivers/pci/controller/dwc/pcie-tegra194.c:1829:23: portability:
> 	Shifting signed 32-bit value by 31 bits is
> 	implementation-defined behaviour. See condition at line 1826.
> 	[shiftTooManyBitsSigned]
> 
>   appl_writel(pcie, (1 << irq), APPL_MSI_CTRL_1);
>                       ^
> The above warning occurs because the '1' is treated as a signed type
> and so fix this by using the 'BIT' macro to ensure that this is defined
> as a unsigned type.
> 
> Fixes: c57247f940e8 PCI: tegra: Add support for PCIe endpoint mode in Tegra194

Looks like I messed up the format of the Fixes: tag and it should be ...

Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")


> Signed-off-by: Jon Hunter <jonathanh@xxxxxxxxxx>
> ---
>  drivers/pci/controller/dwc/pcie-tegra194.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
> index 8fc08336f76e..3c1feeab104f 100644
> --- a/drivers/pci/controller/dwc/pcie-tegra194.c
> +++ b/drivers/pci/controller/dwc/pcie-tegra194.c
> @@ -1826,7 +1826,7 @@ static int tegra_pcie_ep_raise_msi_irq(struct tegra_pcie_dw *pcie, u16 irq)
>  	if (unlikely(irq > 31))
>  		return -EINVAL;
>  
> -	appl_writel(pcie, (1 << irq), APPL_MSI_CTRL_1);
> +	appl_writel(pcie, BIT(irq), APPL_MSI_CTRL_1);
>  
>  	return 0;
>  }
> 

-- 
nvpublic



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux