pdev->evtchn = INVALID_EVTCHN;
pdev->gnt_ref = INVALID_GRANT_REF;
+ pdev->irq = -1;
INIT_WORK(&pdev->op_work, pcifront_do_aer, pdev);
/*For PCIE_AER error handling job*/
flush_scheduled_work();
- unbind_from_irqhandler(pdev->evtchn, pdev);
+
+ if (pdev->irq > 0)
+ unbind_from_irqhandler(pdev->irq, pdev);
if (pdev->evtchn != INVALID_EVTCHN)
xenbus_free_evtchn(pdev->xdev, pdev->evtchn);
if (pdev->gnt_ref != INVALID_GRANT_REF)
gnttab_end_foreign_access(pdev->gnt_ref,
(unsigned long)pdev->sh_info);
+ else
+ free_page((unsigned long)pdev->sh_info);
pdev->xdev->dev.driver_data = NULL;
if (err)
goto out;
- bind_caller_port_to_irqhandler(pdev->evtchn, pcifront_handler_aer,
- SA_SAMPLE_RANDOM, "pcifront", pdev);
+ err = bind_caller_port_to_irqhandler(pdev->evtchn,
+ pcifront_handler_aer,
+ SA_SAMPLE_RANDOM,
+ "pcifront", pdev);
+ if (err < 0) {
+ xenbus_dev_fatal(pdev->xdev, err,
+ "Failed to bind event channel");
+ goto out;
+ }
+ pdev->irq = err;
do_publish:
err = xenbus_transaction_start(&trans);
}
err = pcifront_publish_info(pdev);
+ if (err)
+ free_pdev(pdev);
out:
return err;