Re: [PATCH] drivers: block: save return value of pci_find_capability() in u8

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

 



On 12/6/20 11:45, Puranjay Mohan wrote:
> Callers of pci_find_capability should save the return value in u8.
> change type of variables from int to u8 to match the specification.

I did not understand this, pci_find_capability() does not return u8. 

what is it that we are achieving by changing the variable type ?

This patch will probably also generate type mismatch warning with

certain static analyzers.

> Signed-off-by: Puranjay Mohan <puranjay12@xxxxxxxxx>
> ---
>  drivers/block/mtip32xx/mtip32xx.c | 2 +-
>  drivers/block/skd_main.c          | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
> index 153e2cdecb4d..da57d37c6d20 100644
> --- a/drivers/block/mtip32xx/mtip32xx.c
> +++ b/drivers/block/mtip32xx/mtip32xx.c
> @@ -3936,7 +3936,7 @@ static DEFINE_HANDLER(7);
>  
>  static void mtip_disable_link_opts(struct driver_data *dd, struct pci_dev *pdev)
>  {
> -	int pos;
> +	u8 pos;
>  	unsigned short pcie_dev_ctrl;
>  
>  	pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
> diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
> index a962b4551bed..16d59569129b 100644
> --- a/drivers/block/skd_main.c
> +++ b/drivers/block/skd_main.c
> @@ -3136,7 +3136,7 @@ MODULE_DEVICE_TABLE(pci, skd_pci_tbl);
>  
>  static char *skd_pci_info(struct skd_device *skdev, char *str)
>  {
> -	int pcie_reg;
> +	u8 pcie_reg;
>  
>  	strcpy(str, "PCIe (");
>  	pcie_reg = pci_find_capability(skdev->pdev, PCI_CAP_ID_EXP);






[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