xen/pciback: Drop two backends, squash and cleanup some code.
Hello Konrad Rzeszutek Wilk,
The patch a92336a1176b: "xen/pciback: Drop two backends, squash and cleanup some code." from Jul 19, 2011, leads to the following static checker warning:
drivers/xen/xen-pciback/conf_space_capability.c:163 pm_ctrl_init()
error: passing non negative 135 to ERR_PTR
drivers/xen/xen-pciback/conf_space_capability.c
147 /* Ensure PMEs are disabled */
148 static void *pm_ctrl_init(struct pci_dev *dev, int offset)
149 { 150 int err;
151 u16 value;
152
153 err = pci_read_config_word(dev, offset, &value);
154 if (err)
155 goto out;
156
157 if (value & PCI_PM_CTRL_PME_ENABLE) {
158 value &= ~PCI_PM_CTRL_PME_ENABLE;
159 err = pci_write_config_word(dev, offset, value);
The static check is complaining that pci_write_config_word() can return PCIBIOS_BAD_REGISTER_NUMBER, but actually I think that's not possible.
Anyway, this function is only called from xen_pcibk_config_add_field_offset() so why are we returning a pointer instead of just int?
160 } 161 162 out: 163 return ERR_PTR(err); 164 }
regards,
dan carpenter
Quoted 24 lines · Dan Carpenter
Hello Konrad Rzeszutek Wilk,
The patch
a92336a1176b: "xen/pciback: Drop two backends, squash and cleanup some code." from Jul 19, 2011, leads to the following static checker warning:
drivers/xen/xen-pciback/conf_space_capability.c:163pm_ctrl_init()
error: passing non negative 135 toERR_PTR
drivers/xen/xen-pciback/conf_space_capability.c147 /* Ensure PMEs are disabled */ 148 static void *pm_ctrl_init(struct pci_dev *dev, int offset) 149 { 150 int err; 151 u16 value; 152 153 err = pci_read_config_word(dev, offset, &value); 154 if (err) 155 goto out; 156 157 if (value & PCI_PM_CTRL_PME_ENABLE) { 158 value &= ~PCI_PM_CTRL_PME_ENABLE; 159 err = pci_write_config_word(dev, offset, value);
Quoted 7 lines
The static check is complaining that
pci_write_config_word()can returnPCIBIOS_BAD_REGISTER_NUMBER, but actually I think that's not possible.Anyway, this function is only called from
xen_pcibk_config_add_field_offset()so why are we returning a pointer instead of just int?
Because all the other 'init' could. And 'bar_init' for example returns the BAR value (wrapped in 'struct pci_bar_info').
Quoted 9 lines
160 } 161 162 out: 163 return ERR_PTR(err); 164 }regards,
dan carpenter