Re: [PATCH] xhci: Fix runtime PM imbalance on error

From: kbuild test robot
Date: Thu May 21 2020 - 06:35:14 EST


Hi Dinghao,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on v5.7-rc6 next-20200519]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Dinghao-Liu/xhci-Fix-runtime-PM-imbalance-on-error/20200521-152940
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
config: alpha-allyesconfig (attached as .config)
compiler: alpha-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=alpha

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>, old ones prefixed by <<):

drivers/usb/host/xhci-histb.c: In function 'xhci_histb_probe':
>> drivers/usb/host/xhci-histb.c:243:18: error: expected ';' before 'hcd'
243 | goto disable_pm
| ^
| ;
244 |
245 | hcd = usb_create_hcd(driver, dev, dev_name(dev));
| ~~~

vim +243 drivers/usb/host/xhci-histb.c

195
196 static struct hc_driver __read_mostly xhci_histb_hc_driver;
197 static int xhci_histb_probe(struct platform_device *pdev)
198 {
199 struct device *dev = &pdev->dev;
200 struct xhci_hcd_histb *histb;
201 const struct hc_driver *driver;
202 struct usb_hcd *hcd;
203 struct xhci_hcd *xhci;
204 struct resource *res;
205 int irq;
206 int ret = -ENODEV;
207
208 if (usb_disabled())
209 return -ENODEV;
210
211 driver = &xhci_histb_hc_driver;
212 histb = devm_kzalloc(dev, sizeof(*histb), GFP_KERNEL);
213 if (!histb)
214 return -ENOMEM;
215
216 histb->dev = dev;
217
218 irq = platform_get_irq(pdev, 0);
219 if (irq < 0)
220 return irq;
221
222 histb->ctrl = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
223 if (IS_ERR(histb->ctrl))
224 return PTR_ERR(histb->ctrl);
225
226 ret = xhci_histb_clks_get(histb);
227 if (ret)
228 return ret;
229
230 histb->soft_reset = devm_reset_control_get(dev, "soft");
231 if (IS_ERR(histb->soft_reset)) {
232 dev_err(dev, "failed to get soft reset\n");
233 return PTR_ERR(histb->soft_reset);
234 }
235
236 pm_runtime_enable(dev);
237 pm_runtime_get_sync(dev);
238 device_enable_async_suspend(dev);
239
240 /* Initialize dma_mask and coherent_dma_mask to 32-bits */
241 ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
242 if (ret)
> 243 goto disable_pm
244
245 hcd = usb_create_hcd(driver, dev, dev_name(dev));
246 if (!hcd) {
247 ret = -ENOMEM;
248 goto disable_pm;
249 }
250
251 hcd->regs = histb->ctrl;
252 hcd->rsrc_start = res->start;
253 hcd->rsrc_len = resource_size(res);
254
255 histb->hcd = hcd;
256 dev_set_drvdata(hcd->self.controller, histb);
257
258 ret = xhci_histb_host_enable(histb);
259 if (ret)
260 goto put_hcd;
261
262 xhci = hcd_to_xhci(hcd);
263
264 device_wakeup_enable(hcd->self.controller);
265
266 xhci->main_hcd = hcd;
267 xhci->shared_hcd = usb_create_shared_hcd(driver, dev, dev_name(dev),
268 hcd);
269 if (!xhci->shared_hcd) {
270 ret = -ENOMEM;
271 goto disable_host;
272 }
273
274 if (device_property_read_bool(dev, "usb2-lpm-disable"))
275 xhci->quirks |= XHCI_HW_LPM_DISABLE;
276
277 if (device_property_read_bool(dev, "usb3-lpm-capable"))
278 xhci->quirks |= XHCI_LPM_SUPPORT;
279
280 /* imod_interval is the interrupt moderation value in nanoseconds. */
281 xhci->imod_interval = 40000;
282 device_property_read_u32(dev, "imod-interval-ns",
283 &xhci->imod_interval);
284
285 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
286 if (ret)
287 goto put_usb3_hcd;
288
289 if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
290 xhci->shared_hcd->can_do_streams = 1;
291
292 ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
293 if (ret)
294 goto dealloc_usb2_hcd;
295
296 device_enable_async_suspend(dev);
297 pm_runtime_put_noidle(dev);
298
299 /*
300 * Prevent runtime pm from being on as default, users should enable
301 * runtime pm using power/control in sysfs.
302 */
303 pm_runtime_forbid(dev);
304
305 return 0;
306
307 dealloc_usb2_hcd:
308 usb_remove_hcd(hcd);
309 put_usb3_hcd:
310 usb_put_hcd(xhci->shared_hcd);
311 disable_host:
312 xhci_histb_host_disable(histb);
313 put_hcd:
314 usb_put_hcd(hcd);
315 disable_pm:
316 pm_runtime_put_sync(dev);
317 pm_runtime_disable(dev);
318
319 return ret;
320 }
321

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip