diff --git a/drivers/staging/greybus/connection.c b/drivers/staging/greybus/connection.c index 32f1ec55b48f..4515bcd9dac8 100644 --- a/drivers/staging/greybus/connection.c +++ b/drivers/staging/greybus/connection.c @@ -226,11 +226,10 @@ void gb_connection_destroy(struct gb_connection *connection) return; /* XXX Need to wait for any outstanding requests to complete */ - WARN_ON(!list_empty(&connection->operations)); - - list_for_each_entry_safe(operation, next, &connection->operations, - links) { - gb_operation_cancel(operation); + if (WARN_ON(!list_empty(&connection->operations))) { + list_for_each_entry_safe(operation, next, + &connection->operations, links) + gb_operation_cancel(operation); } spin_lock_irq(&gb_connections_lock); list_del(&connection->interface_links);