Re: [PATCH 3/5] crypto/nx: Create nx842_delete_coproc function

2017-04-04 Thread Michael Ellerman
Haren Myneni <ha...@linux.vnet.ibm.com> writes:

> [PATCH 3/5] crypto/nx: Create nx842_delete_coproc function
>
> Move deleting coprocessor info upon exit or failure to
> nx842_delete_coproc().

Naming again, this deletes *all* the coprocs, so the name should be
plural.

cheers


[PATCH 3/5] crypto/nx: Create nx842_delete_coproc function

2017-04-01 Thread Haren Myneni
[PATCH 3/5] crypto/nx: Create nx842_delete_coproc function

Move deleting coprocessor info upon exit or failure to
nx842_delete_coproc().

Signed-off-by: Haren Myneni <ha...@us.ibm.com>
---
 drivers/crypto/nx/nx-842-powernv.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/crypto/nx/nx-842-powernv.c 
b/drivers/crypto/nx/nx-842-powernv.c
index 4cd6a6f..8737e90 100644
--- a/drivers/crypto/nx/nx-842-powernv.c
+++ b/drivers/crypto/nx/nx-842-powernv.c
@@ -597,6 +597,16 @@ static int __init nx842_powernv_probe(struct device_node 
*dn)
return 0;
 }
 
+static void nx842_delete_coproc(void)
+{
+   struct nx842_coproc *coproc, *n;
+
+   list_for_each_entry_safe(coproc, n, _coprocs, list) {
+   list_del(>list);
+   kfree(coproc);
+   }
+}
+
 static struct nx842_constraints nx842_powernv_constraints = {
.alignment =DDE_BUFFER_ALIGN,
.multiple = DDE_BUFFER_LAST_MULT,
@@ -656,13 +666,7 @@ static __init int nx842_powernv_init(void)
 
ret = crypto_register_alg(_powernv_alg);
if (ret) {
-   struct nx842_coproc *coproc, *n;
-
-   list_for_each_entry_safe(coproc, n, _coprocs, list) {
-   list_del(>list);
-   kfree(coproc);
-   }
-
+   nx842_delete_coproc();
return ret;
}
 
@@ -672,13 +676,8 @@ static __init int nx842_powernv_init(void)
 
 static void __exit nx842_powernv_exit(void)
 {
-   struct nx842_coproc *coproc, *n;
-
crypto_unregister_alg(_powernv_alg);
 
-   list_for_each_entry_safe(coproc, n, _coprocs, list) {
-   list_del(>list);
-   kfree(coproc);
-   }
+   nx842_delete_coproc();
 }
 module_exit(nx842_powernv_exit);
-- 
1.8.3.1