Skip to content

Commit

Permalink
crypto: rockchip - fix to check return value
Browse files Browse the repository at this point in the history
crypto_engine_alloc_init may fail, e.g., as result of a fail of
devm_kzalloc or kthread_create_worker. Other drivers (e.g.,
amlogic-gxl-core.c, aspeed-acry.c, aspeed-hace.c, jr.c, etc.) check
crypto_engine_alloc_init's return value and return -ENOMEM in case
a NULL pointer is returned. This patch inserts a corresponding
return value check to rk3288_crypto.c.

Signed-off-by: Kilian Zinnecker <kilian.zinnecker@mail.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Kilian Zinnecker authored and Herbert Xu committed Feb 24, 2024
1 parent e63df1e commit a24e3b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/crypto/rockchip/rk3288_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,11 @@ static int rk_crypto_probe(struct platform_device *pdev)
}

crypto_info->engine = crypto_engine_alloc_init(&pdev->dev, true);
if (!crypto_info->engine) {
err = -ENOMEM;
goto err_crypto;
}

crypto_engine_start(crypto_info->engine);
init_completion(&crypto_info->complete);

Expand Down

0 comments on commit a24e3b5

Please sign in to comment.