aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Miguel Silva <[email protected]>2021-07-27 11:05:16 +0100
committerGreg Kroah-Hartman <[email protected]>2021-07-27 16:25:31 +0200
commitcbbdb3fe0d974d655c87c3e6ba2990d5496b9f82 (patch)
treefb46c550bcea16b87b28466e21362e834e0c0e30
parent41f673183862a183d4ea0522c045fabfbd1b28c8 (diff)
usb: isp1760: rework cache initialization error handling
If we fail to create qtd cache we were not destroying the urb_listitem, rework the error handling logic to cope with that. Signed-off-by: Rui Miguel Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/isp1760/isp1760-hcd.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
index a018394d54f8..825be736be33 100644
--- a/drivers/usb/isp1760/isp1760-hcd.c
+++ b/drivers/usb/isp1760/isp1760-hcd.c
@@ -2527,17 +2527,23 @@ int __init isp1760_init_kmem_once(void)
SLAB_MEM_SPREAD, NULL);
if (!qtd_cachep)
- return -ENOMEM;
+ goto destroy_urb_listitem;
qh_cachep = kmem_cache_create("isp1760_qh", sizeof(struct isp1760_qh),
0, SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL);
- if (!qh_cachep) {
- kmem_cache_destroy(qtd_cachep);
- return -ENOMEM;
- }
+ if (!qh_cachep)
+ goto destroy_qtd;
return 0;
+
+destroy_qtd:
+ kmem_cache_destroy(qtd_cachep);
+
+destroy_urb_listitem:
+ kmem_cache_destroy(urb_listitem_cachep);
+
+ return -ENOMEM;
}
void isp1760_deinit_kmem_cache(void)