Skip to contentSkip to conversation

drivers: infiniband: save return value of pci_find_capability() in u8

PATCH In review Puranjay Mohan 2 participants 2 messages Dec 6, 2020 – Dec 7, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers: infiniband: save return value of pci_find_capability() in u8

Callers of pci_find_capability should save the return value in u8. change type of variables from int to u8 to match the specification.

---
 drivers/infiniband/hw/mthca/mthca_reset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mthca/mthca_reset.c +2 -2
index 2a6979e4ae1c..1b6ec870bd47 100644
@@ -45,9 +45,9 @@ int mthca_reset(struct mthca_dev *mdev)
 	u32 *hca_header    = NULL;
 	u32 *bridge_header = NULL;
 	struct pci_dev *bridge = NULL;
-	int bridge_pcix_cap = 0;
+	u8 bridge_pcix_cap = 0;
 	int hca_pcie_cap = 0;
-	int hca_pcix_cap = 0;
+	u8 hca_pcix_cap = 0;
 
 	u16 devctl;
 	u16 linkctl;
Signature · 1 line
2.27.0
#1 lore raw
Quoted 13 lines · Puranjay Mohan

Callers of pci_find_capability should save the return value in u8. change type of variables from int to u8 to match the specification.

---
 drivers/infiniband/hw/mthca/mthca_reset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mthca/mthca_reset.c +0 -0
index 2a6979e4ae1c..1b6ec870bd47 100644

drivers/infiniband/hw/mthca/mthca_reset.c int mthca_reset(struct mthca_dev *mdev) · line 50

Quoted 8 lines
drivers/infiniband/hw/mthca/mthca_reset.c +2 -2
@@ -45,9 +45,9 @@ int mthca_reset(struct mthca_dev *mdev)
 	u32 *hca_header    = NULL;
 	u32 *bridge_header = NULL;
 	struct pci_dev *bridge = NULL;
-	int bridge_pcix_cap = 0;
+	u8 bridge_pcix_cap = 0;
 	int hca_pcie_cap = 0;
-	int hca_pcix_cap = 0;
+	u8 hca_pcix_cap = 0;

I don't think this is really worth changing. That mthca_reset() path is such a mess that this is the least of the worries there. This patch shouldn't have any risk, but I wouldn't want my fingerprints on that function in case somebody else looks at it later ;-)

Quoted 5 lines
drivers/infiniband/hw/mthca/mthca_reset.c +0 -0
 	u16 devctl;
 	u16 linkctl;
Signature · 1 line
2.27.0