Skip to contentSkip to conversation

xen/pciback: fix cast to restricted pci_ers_result_t and pci_power_t

PATCH In review Min-Hua Chen 2 participants 2 messages Sep 17, 2024 – Sep 25, 2024 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/pciback: fix cast to restricted pci_ers_result_t and pci_power_t

This patch fix the following sparse warning by applying __force cast to pci_ers_result_t and pci_power_t.

drivers/xen/xen-pciback/pci_stub.c:760:16: sparse: warning: cast to restricted pci_ers_result_t drivers/xen/xen-pciback/conf_space_capability.c:125:22: sparse: warning: cast to restricted pci_power_t

No functional changes intended.

---
 drivers/xen/xen-pciback/conf_space_capability.c | 2 +-
 drivers/xen/xen-pciback/pci_stub.c              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xen-pciback/conf_space_capability.c +1 -1
index 1948a9700c8f..cf568e899ee2 100644
@@ -122,7 +122,7 @@ static int pm_ctrl_write(struct pci_dev *dev, int offset, u16 new_value,
 	if (err)
 		goto out;
 
-	new_state = (pci_power_t)(new_value & PCI_PM_CTRL_STATE_MASK);
+	new_state = (__force pci_power_t)(new_value & PCI_PM_CTRL_STATE_MASK);
 
 	new_value &= PM_OK_BITS;
 	if ((old_value & PM_OK_BITS) != new_value) {
drivers/xen/xen-pciback/pci_stub.c +1 -1
index 4faebbb84999..368738312696 100644
@@ -757,7 +757,7 @@ static pci_ers_result_t common_process(struct pcistub_device *psdev,
 	}
 	clear_bit(_PCIB_op_pending, (unsigned long *)&pdev->flags);
 
-	res = (pci_ers_result_t)aer_op->err;
+	res = (__force pci_ers_result_t)aer_op->err;
 	return res;
 }
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Min-Hua Chen

This patch fix the following sparse warning by applying __force cast to pci_ers_result_t and pci_power_t.

drivers/xen/xen-pciback/pci_stub.c:760:16: sparse: warning: cast to restricted pci_ers_result_t drivers/xen/xen-pciback/conf_space_capability.c:125:22: sparse: warning: cast to restricted pci_power_t

No functional changes intended.

Juergen