* Re: xen/pciback: Drop two backends, squash and cleanup some code.
@ 2014-10-31 15:30 Dan Carpenter
2014-12-01 15:36 ` Konrad Rzeszutek Wilk
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-10-31 15:30 UTC (permalink / raw)
To: konrad.wilk; +Cc: xen-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: xen/pciback: Drop two backends, squash and cleanup some code.
2014-10-31 15:30 xen/pciback: Drop two backends, squash and cleanup some code Dan Carpenter
@ 2014-12-01 15:36 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Rzeszutek Wilk @ 2014-12-01 15:36 UTC (permalink / raw)
To: Dan Carpenter; +Cc: xen-devel
On Fri, Oct 31, 2014 at 06:30:01PM +0300, Dan Carpenter wrote:
> 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?
Because all the other 'init' could. And 'bar_init' for example
returns the BAR value (wrapped in 'struct pci_bar_info').
>
> 160 }
> 161
> 162 out:
> 163 return ERR_PTR(err);
> 164 }
>
> regards,
> dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-01 22:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-31 15:30 xen/pciback: Drop two backends, squash and cleanup some code Dan Carpenter
2014-12-01 15:36 ` Konrad Rzeszutek Wilk
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.