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 07/12/2020 01:26, Bjorn Helgaas wrote:
On Sun, Dec 06, 2020 at 11:08:14PM +0000, Chaitanya Kulkarni wrote:
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.the com

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.

There's a patch pending via the PCI tree to change the return type to
u8.  We can do one of:

   - Ignore this.  It only changes something on the stack, so no real
     space saving and there's no problem assigning the u8 return value
     to the "int".

I seem to remember some compilers would emit a sequence to constrain the
result to a valid char, but that looks like it is fixed in gcc-9 if the
input was also u8

--
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html



[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