mirror of
https://github.com/torvalds/linux.git
synced 2024-12-19 09:32:32 +00:00
greybus: core: return error code when creating host device
Return a pointer-coded error from greybus_create_hd() rather than NULL in the event an error occurs. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
6b7d5a1f47
commit
8ea70fe049
@ -187,7 +187,7 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
|
||||
if ((!driver->message_send) || (!driver->message_cancel) ||
|
||||
(!driver->submit_svc)) {
|
||||
pr_err("Must implement all greybus_host_driver callbacks!\n");
|
||||
return NULL;
|
||||
return ERR_PTR(-EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -202,7 +202,7 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
|
||||
|
||||
hd = kzalloc(sizeof(*hd) + driver->hd_priv_size, GFP_KERNEL);
|
||||
if (!hd)
|
||||
return NULL;
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
kref_init(&hd->kref);
|
||||
hd->parent = parent;
|
||||
@ -215,7 +215,7 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
|
||||
endo = gb_endo_create(hd, endo_id);
|
||||
if (IS_ERR(endo)) {
|
||||
greybus_remove_hd(hd);
|
||||
return NULL;
|
||||
return ERR_CAST(endo);
|
||||
}
|
||||
hd->endo = endo;
|
||||
|
||||
|
@ -556,9 +556,9 @@ static int ap_probe(struct usb_interface *interface,
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
|
||||
hd = greybus_create_hd(&es1_driver, &udev->dev, ES1_GBUF_MSG_SIZE_MAX);
|
||||
if (!hd) {
|
||||
if (IS_ERR(hd)) {
|
||||
usb_put_dev(udev);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(hd);
|
||||
}
|
||||
|
||||
es1 = hd_to_es1(hd);
|
||||
|
@ -556,9 +556,9 @@ static int ap_probe(struct usb_interface *interface,
|
||||
udev = usb_get_dev(interface_to_usbdev(interface));
|
||||
|
||||
hd = greybus_create_hd(&es1_driver, &udev->dev, ES1_GBUF_MSG_SIZE_MAX);
|
||||
if (!hd) {
|
||||
if (IS_ERR(hd)) {
|
||||
usb_put_dev(udev);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(hd);
|
||||
}
|
||||
|
||||
es1 = hd_to_es1(hd);
|
||||
|
Loading…
Reference in New Issue
Block a user