staging: unisys: visorbus: add error handling for chipset_device_create
Adds error handling to the chipset_device_create message. If it returns a failure, it is assumed it has not signaled the s-Par firmware of the failure and the caller must do that. Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Reviewed-by: Tim Sell <timothy.sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0315657116
commit
3f49a21dec
@ -1118,25 +1118,29 @@ chipset_bus_destroy(struct visor_device *dev)
|
|||||||
bus_destroy_response(dev, 0);
|
bus_destroy_response(dev, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
chipset_device_create(struct visor_device *dev_info)
|
chipset_device_create(struct visor_device *dev_info)
|
||||||
{
|
{
|
||||||
int rc;
|
int err;
|
||||||
u32 bus_no = dev_info->chipset_bus_no;
|
u32 bus_no = dev_info->chipset_bus_no;
|
||||||
u32 dev_no = dev_info->chipset_dev_no;
|
u32 dev_no = dev_info->chipset_dev_no;
|
||||||
|
|
||||||
POSTCODE_LINUX(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
|
POSTCODE_LINUX(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
|
||||||
DIAG_SEVERITY_PRINT);
|
DIAG_SEVERITY_PRINT);
|
||||||
|
|
||||||
rc = create_visor_device(dev_info);
|
err = create_visor_device(dev_info);
|
||||||
device_create_response(dev_info, rc);
|
if (err < 0) {
|
||||||
|
|
||||||
if (rc < 0)
|
|
||||||
POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
|
POSTCODE_LINUX(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
|
||||||
DIAG_SEVERITY_ERR);
|
DIAG_SEVERITY_ERR);
|
||||||
else
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
POSTCODE_LINUX(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
|
POSTCODE_LINUX(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
|
||||||
DIAG_SEVERITY_PRINT);
|
DIAG_SEVERITY_PRINT);
|
||||||
|
|
||||||
|
device_create_response(dev_info, err);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
int chipset_bus_create(struct visor_device *bus_info);
|
int chipset_bus_create(struct visor_device *bus_info);
|
||||||
void chipset_bus_destroy(struct visor_device *bus_info);
|
void chipset_bus_destroy(struct visor_device *bus_info);
|
||||||
void chipset_device_create(struct visor_device *dev_info);
|
int chipset_device_create(struct visor_device *dev_info);
|
||||||
void chipset_device_destroy(struct visor_device *dev_info);
|
void chipset_device_destroy(struct visor_device *dev_info);
|
||||||
void chipset_device_pause(struct visor_device *dev_info);
|
void chipset_device_pause(struct visor_device *dev_info);
|
||||||
void chipset_device_resume(struct visor_device *dev_info);
|
void chipset_device_resume(struct visor_device *dev_info);
|
||||||
|
@ -853,14 +853,14 @@ my_device_create(struct controlvm_message *inmsg)
|
|||||||
spar_vhba_channel_protocol_uuid) == 0) {
|
spar_vhba_channel_protocol_uuid) == 0) {
|
||||||
err = save_crash_message(inmsg, CRASH_DEV);
|
err = save_crash_message(inmsg, CRASH_DEV);
|
||||||
if (err)
|
if (err)
|
||||||
goto err_free_dev_info;
|
goto err_destroy_visorchannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inmsg->hdr.flags.response_expected == 1) {
|
if (inmsg->hdr.flags.response_expected == 1) {
|
||||||
pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL);
|
pmsg_hdr = kzalloc(sizeof(*pmsg_hdr), GFP_KERNEL);
|
||||||
if (!pmsg_hdr) {
|
if (!pmsg_hdr) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_free_dev_info;
|
goto err_destroy_visorchannel;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(pmsg_hdr, &inmsg->hdr,
|
memcpy(pmsg_hdr, &inmsg->hdr,
|
||||||
@ -868,11 +868,17 @@ my_device_create(struct controlvm_message *inmsg)
|
|||||||
dev_info->pending_msg_hdr = pmsg_hdr;
|
dev_info->pending_msg_hdr = pmsg_hdr;
|
||||||
}
|
}
|
||||||
/* Chipset_device_create will send response */
|
/* Chipset_device_create will send response */
|
||||||
chipset_device_create(dev_info);
|
err = chipset_device_create(dev_info);
|
||||||
|
if (err)
|
||||||
|
goto err_destroy_visorchannel;
|
||||||
|
|
||||||
POSTCODE_LINUX(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
|
POSTCODE_LINUX(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
|
||||||
DIAG_SEVERITY_PRINT);
|
DIAG_SEVERITY_PRINT);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_destroy_visorchannel:
|
||||||
|
visorchannel_destroy(visorchannel);
|
||||||
|
|
||||||
err_free_dev_info:
|
err_free_dev_info:
|
||||||
kfree(dev_info);
|
kfree(dev_info);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user