Skip to contentSkip to conversation

char: hw_random: ba431-rng: removed unneeded call to platform_set_drvdata()

PATCH In review Andrei Coardos 2 participants 2 messages Aug 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 char: hw_random: ba431-rng: removed unneeded call to platform_set_drvdata()

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

---
 drivers/char/hw_random/ba431-rng.c | 2 --
 1 file changed, 2 deletions(-)
drivers/char/hw_random/ba431-rng.c +0 -2
index 5b7ca0416490..b1518dd52a24 100644
@@ -189,8 +189,6 @@ static int ba431_trng_probe(struct platform_device *pdev)
 	ba431->rng.cleanup = ba431_trng_cleanup;
 	ba431->rng.read = ba431_trng_read;
 
-	platform_set_drvdata(pdev, ba431);
-
 	ret = devm_hwrng_register(&pdev->dev, &ba431->rng);
 	if (ret) {
 		dev_err(&pdev->dev, "BA431 registration failed (%d)\n", ret);
Signature · 1 line
2.34.1
#1 lore raw
Quoted 25 lines · Andrei Coardos

This function call was found to be unnecessary as there is no equivalent platform_get_drvdata() call to access the private data of the driver. Also, the private data is defined in this driver, so there is no risk of it being accessed outside of this driver file.

---
 drivers/char/hw_random/ba431-rng.c | 2 --
 1 file changed, 2 deletions(-)
drivers/char/hw_random/ba431-rng.c +0 -2
index 5b7ca0416490..b1518dd52a24 100644
@@ -189,8 +189,6 @@ static int ba431_trng_probe(struct platform_device *pdev)
 	ba431->rng.cleanup = ba431_trng_cleanup;
 	ba431->rng.read = ba431_trng_read;
 
-	platform_set_drvdata(pdev, ba431);
-
 	ret = devm_hwrng_register(&pdev->dev, &ba431->rng);
 	if (ret) {
 		dev_err(&pdev->dev, "BA431 registration failed (%d)\n", ret);
Signature · 1 line
2.34.1

This was already removed in e8c1fdcc62d3 ("hwrng: ba431 - do not set drvdata").