Commit cbbdb3fe authored by Rui Miguel Silva's avatar Rui Miguel Silva Committed by Greg Kroah-Hartman

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: default avatarRui Miguel Silva <rui.silva@linaro.org>
Link: https://lore.kernel.org/r/20210727100516.4190681-4-rui.silva@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 41f67318
...@@ -2527,17 +2527,23 @@ int __init isp1760_init_kmem_once(void) ...@@ -2527,17 +2527,23 @@ int __init isp1760_init_kmem_once(void)
SLAB_MEM_SPREAD, NULL); SLAB_MEM_SPREAD, NULL);
if (!qtd_cachep) if (!qtd_cachep)
return -ENOMEM; goto destroy_urb_listitem;
qh_cachep = kmem_cache_create("isp1760_qh", sizeof(struct isp1760_qh), qh_cachep = kmem_cache_create("isp1760_qh", sizeof(struct isp1760_qh),
0, SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL); 0, SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL);
if (!qh_cachep) { if (!qh_cachep)
kmem_cache_destroy(qtd_cachep); goto destroy_qtd;
return -ENOMEM;
}
return 0; 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) void isp1760_deinit_kmem_cache(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment