From 24e094d687a23878024589a854ce66a070b769cc Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Thu, 21 Jan 2016 17:34:16 +0100 Subject: greybus: connection: return error-valued pointer on creation errors Return an ERR_PTR on errors when creating connections. This allows driver probe to fail with a more informative error message as not all connection creation errors are due to memory exhaustion. Reviewed-by: Viresh Kumar Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/control.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/staging/greybus/control.c') diff --git a/drivers/staging/greybus/control.c b/drivers/staging/greybus/control.c index a766ec8..fb0bb1c 100644 --- a/drivers/staging/greybus/control.c +++ b/drivers/staging/greybus/control.c @@ -187,8 +187,10 @@ struct gb_control *gb_control_create(struct gb_interface *intf) return NULL; control->connection = gb_connection_create_control(intf); - if (!control->connection) { - dev_err(&intf->dev, "failed to create control connection\n"); + if (IS_ERR(control->connection)) { + dev_err(&intf->dev, + "failed to create control connection: %ld\n", + PTR_ERR(control->connection)); kfree(control); return NULL; } -- cgit v1.1