diff mbox series

[2/3] crypto: stm32/hash - Drop if block with always false condition

Message ID 20230731165456.799784-3-u.kleine-koenig@pengutronix.de
State Accepted
Commit 3feec4ef9f99e2ca3c4614bc0c46e9c0ad337357
Headers show
Series stm32/hash - Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König July 31, 2023, 4:54 p.m. UTC
stm32_hash_remove() is only called after stm32_hash_probe() succeeded. In
this case platform_set_drvdata() was called with a non-NULL data patameter.

The check for hdev being non-NULL can be dropped because hdev is never NULL
(or something bad like memory corruption happened and then the check
doesn't help any more either).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/stm32/stm32-hash.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/stm32/stm32-hash.c b/drivers/crypto/stm32/stm32-hash.c
index 75d281edae2a..b10243035584 100644
--- a/drivers/crypto/stm32/stm32-hash.c
+++ b/drivers/crypto/stm32/stm32-hash.c
@@ -2114,13 +2114,9 @@  static int stm32_hash_probe(struct platform_device *pdev)
 
 static int stm32_hash_remove(struct platform_device *pdev)
 {
-	struct stm32_hash_dev *hdev;
+	struct stm32_hash_dev *hdev = platform_get_drvdata(pdev);
 	int ret;
 
-	hdev = platform_get_drvdata(pdev);
-	if (!hdev)
-		return -ENODEV;
-
 	ret = pm_runtime_get_sync(hdev->dev);
 
 	stm32_hash_unregister_algs(hdev);