From 4f7e413b2d2d2825dbb36b73f06e69514022b132 Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Wed, 20 Jul 2016 16:40:27 +0200 Subject: [PATCH] greybus: interface: hibernate UniPro link in activation error path To be well-behaved, we should hibernate the link before disabling UniPro in case the link has already been established (i.e. when the interface type has been detected as UniPro or Greybus). Signed-off-by: Johan Hovold Reviewed-by: Alex Elder Reviewed-by: Viresh Kumar Reviewed-by: Sandeep Patil Reviewed-by: Patrick Titiano Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/interface.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/staging/greybus/interface.c b/drivers/staging/greybus/interface.c index f5ed79c687d2..919eaa0a46c7 100644 --- a/drivers/staging/greybus/interface.c +++ b/drivers/staging/greybus/interface.c @@ -947,8 +947,15 @@ static int _gb_interface_activate(struct gb_interface *intf, goto err_refclk_disable; ret = gb_interface_activate_operation(intf, type); - if (ret) - goto err_unipro_disable; + if (ret) { + switch (*type) { + case GB_INTERFACE_TYPE_UNIPRO: + case GB_INTERFACE_TYPE_GREYBUS: + goto err_hibernate_link; + default: + goto err_unipro_disable; + } + } ret = gb_interface_read_dme(intf); if (ret) -- 2.39.2