Skip to contentSkip to conversation

staging: nvec: paz00: remove unneeded call to platform_set_drvdata()

PATCH In review Andrei Coardos 4 participants 4 messages Aug 9, 2023 – Oct 10, 2023

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

PATCH 1/1 staging: nvec: paz00: remove 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/staging/nvec/nvec_paz00.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/nvec/nvec_paz00.c +0 -2
index 55d59840fca4..9c01c51f0ab5 100644
@@ -53,8 +53,6 @@ static int nvec_paz00_probe(struct platform_device *pdev)
 	led->cdev.flags |= LED_CORE_SUSPENDRESUME;
 	led->nvec = nvec;
 
-	platform_set_drvdata(pdev, led);
-
 	ret = devm_led_classdev_register(&pdev->dev, &led->cdev);
 	if (ret < 0)
 		return ret;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 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.

---

I think you are right, but why are we doing this? That one line is hardly a huge eyesore. It's all risk and no reward.

Have you tested this change on real hardware?

regards,
dan carpenter

maintainer
#2 lore raw

Hi,

Quoted 11 lines · Dan Carpenter
Quoted 7 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.

---

I think you are right, but why are we doing this? That one line is hardly a huge eyesore. It's all risk and no reward.

I guess this was placed in order to implement a module unload function, but this was never done. The driver also seems to have found another method to get its private data, so this can be safely removed.

Quoted 1 line

Have you tested this change on real hardware?

I just checked that it compiles and works on my AC100.

Thanks!

Marc

Acked-by on v1 1/1
#3 lore raw
In reply to Andrei Coardos
Quoted 9 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/staging/nvec/nvec_paz00.c | 2 --
 1 file changed, 2 deletions(-)

Seems fine, and if Marc has tested it, that's good enough for me: