summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorHaren Myneni <haren@linux.vnet.ibm.com>2017-08-31 00:13:15 -0700
committerMichael Ellerman <mpe@ellerman.id.au>2017-09-01 16:42:48 +1000
commit1ee51b28ee6ad7919da4fbe9672263dd274dcbfe (patch)
tree90a4c7ff4b77bcf6e59dd9fb3059a1f43fa3eece /drivers/crypto
parent56c10d5ea68b9a1425df0dedbe5d2710cc7d8bfa (diff)
downloadlinux-1ee51b28ee6ad7919da4fbe9672263dd274dcbfe.tar.gz
linux-1ee51b28ee6ad7919da4fbe9672263dd274dcbfe.tar.bz2
linux-1ee51b28ee6ad7919da4fbe9672263dd274dcbfe.zip
crypto/nx: Create nx842_delete_coprocs function
Move deleting coprocessors info upon exit or failure to nx842_delete_coprocs(). Signed-off-by: Haren Myneni <haren@us.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/nx/nx-842-powernv.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/crypto/nx/nx-842-powernv.c b/drivers/crypto/nx/nx-842-powernv.c
index 1bd19e03eb7d..67dc06f9b557 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -593,6 +593,16 @@ static int __init nx842_powernv_probe(struct device_node *dn)
return 0;
}
+static void nx842_delete_coprocs(void)
+{
+ struct nx842_coproc *coproc, *n;
+
+ list_for_each_entry_safe(coproc, n, &nx842_coprocs, list) {
+ list_del(&coproc->list);
+ kfree(coproc);
+ }
+}
+
static struct nx842_constraints nx842_powernv_constraints = {
.alignment = DDE_BUFFER_ALIGN,
.multiple = DDE_BUFFER_LAST_MULT,
@@ -652,13 +662,7 @@ static __init int nx842_powernv_init(void)
ret = crypto_register_alg(&nx842_powernv_alg);
if (ret) {
- struct nx842_coproc *coproc, *n;
-
- list_for_each_entry_safe(coproc, n, &nx842_coprocs, list) {
- list_del(&coproc->list);
- kfree(coproc);
- }
-
+ nx842_delete_coprocs();
return ret;
}
@@ -668,13 +672,8 @@ module_init(nx842_powernv_init);
static void __exit nx842_powernv_exit(void)
{
- struct nx842_coproc *coproc, *n;
-
crypto_unregister_alg(&nx842_powernv_alg);
- list_for_each_entry_safe(coproc, n, &nx842_coprocs, list) {
- list_del(&coproc->list);
- kfree(coproc);
- }
+ nx842_delete_coprocs();
}
module_exit(nx842_powernv_exit);