Re: [PATCH V2 4/4] PCI: consolidate return value check for pci_find_(ext_)capability

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

 



On Tue, Jun 30, 2015 at 09:16:44AM +0800, Wei Yang wrote:
> The return value of the pci_find_(ext_)capability is the position of this
> Cap.  After previous two patches clean up, the position returned is an
> unsigned value. Only 0 indicates the Cap is not presented.
> 
> This patch consolidates the form of check from (pos <= 0)to (!pos).
> 
> Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx>

Applied to pci/misc with changelog as below.

It seems pretty clear to me that pci_find_capability() returns either 0 or
a u8 value.  pci_find_ext_capability() does return an int.  It looks to me
like it can never be negative, but if you wanted it to be even more clear,
you could easily change just pci_find_next_ext_capability() to use a u16
for "pos".  That would be very simple and wouldn't change any interfaces.

commit d5fa86074987b1b5fcbfba8c9315e75ff7262f71
Author: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx>
Date:   Tue Jun 30 09:16:44 2015 +0800

    PCI: Simplify pci_find_(ext_)capability() return value checks
    
    The return value of the pci_find_(ext_)capability() is either zero or the
    position of a capability.  It is never negative.
    
    This patch consolidates the form of check from (pos <= 0) to (!pos).
    
    Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.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