diff options
| author | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2018-08-28 12:40:30 +0530 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-09-06 23:12:54 -0700 |
| commit | d06bb4edc69e7d38fe94fee7ecaede18c1771a35 (patch) | |
| tree | 931980453cb06018a0b3821903c7669068040c34 | |
| parent | 356bd90ee7d4caac787e2c4c9da68b585b7cf48b (diff) | |
f_qc_rndis: Call rndis_ipa_init() from rndis_qc_bind()
During composition switch, current driver ends up calling
rndis_ipa_cleanup twice without calling rndis_ipa_init() in between.
This could cause spinbug in IPA driver due to uninitialized spin lock.
Hence fix the issue by moving rndis_ipa_init() to bind() callback and
calling rndis_ipa_cleanup() in unbind() callback.
Change-Id: I1be18de9137ba61cf0f004c7edeac54235617d33
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
| -rw-r--r-- | drivers/usb/gadget/function/f_qc_rndis.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/usb/gadget/function/f_qc_rndis.c b/drivers/usb/gadget/function/f_qc_rndis.c index 8a2346ce6b42..8e558c364abc 100644 --- a/drivers/usb/gadget/function/f_qc_rndis.c +++ b/drivers/usb/gadget/function/f_qc_rndis.c @@ -6,7 +6,7 @@ * Copyright (C) 2008 Nokia Corporation * Copyright (C) 2009 Samsung Electronics * Author: Michal Nazarewicz (mina86@mina86.com) - * Copyright (c) 2012-2017, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 @@ -911,6 +911,13 @@ rndis_qc_bind(struct usb_configuration *c, struct usb_function *f) int status; struct usb_ep *ep; + status = rndis_ipa_init(&rndis_ipa_params); + if (status) { + pr_err("%s: failed to init rndis_ipa\n", __func__); + return status; + } + + rndis_ipa_supported = true; /* maybe allocate device-global string IDs */ if (rndis_qc_string_defs[0].id == 0) { @@ -1203,11 +1210,8 @@ usb_function *rndis_qc_bind_config_vendor(struct usb_function_instance *fi, struct f_rndis_qc_opts *opts = container_of(fi, struct f_rndis_qc_opts, func_inst); struct f_rndis_qc *rndis; - int status; /* allocate and initialize one new instance */ - status = -ENOMEM; - opts = container_of(fi, struct f_rndis_qc_opts, func_inst); opts->refcnt++; @@ -1221,7 +1225,6 @@ usb_function *rndis_qc_bind_config_vendor(struct usb_function_instance *fi, pr_debug("setting host_ethaddr=%pM, device_ethaddr=%pM\n", rndis_ipa_params.host_ethaddr, rndis_ipa_params.device_ethaddr); - rndis_ipa_supported = true; ether_addr_copy(rndis->ethaddr, rndis_ipa_params.host_ethaddr); rndis_ipa_params.device_ready_notify = rndis_net_ready_notify; @@ -1263,19 +1266,9 @@ usb_function *rndis_qc_bind_config_vendor(struct usb_function_instance *fi, rndis->func.resume = rndis_qc_resume; rndis->func.free_func = rndis_qc_free; - status = rndis_ipa_init(&rndis_ipa_params); - if (status) { - pr_err("%s: failed to init rndis_ipa\n", __func__); - goto fail; - } - _rndis_qc = rndis; return &rndis->func; -fail: - kfree(rndis); - _rndis_qc = NULL; - return ERR_PTR(status); } static struct usb_function *qcrndis_alloc(struct usb_function_instance *fi) |
