[PATCH 5.5 176/367] crypto: sun8i-ce - fix removal of module

Greg Kroah-Hartman
2020-02-10T13:02:14Z

From: Corentin Labbe <clabbe.montjoie@gmail.com>

commit 93d24ac4b26770f8e5118a731cd9314f3808bd10 upstream.

Removing the driver cause an oops due to the fact we clean an extra
channel.
Let's give the right index to the cleaning function.

Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine")
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -624,7 +624,7 @@ error_alg:
error_irq:
sun8i_ce_pm_exit(ce);
error_pm:
- sun8i_ce_free_chanlist(ce, MAXFLOW);
+ sun8i_ce_free_chanlist(ce, MAXFLOW - 1);
return err;
}

@@ -638,7 +638,7 @@ static int sun8i_ce_remove(struct platfo
debugfs_remove_recursive(ce->dbgfs_dir);
#endif

- sun8i_ce_free_chanlist(ce, MAXFLOW);
+ sun8i_ce_free_chanlist(ce, MAXFLOW - 1);

sun8i_ce_pm_exit(ce);
return 0;