2023-08-09 16:22:31

by Andrei Coardos

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Andrei Coardos <[email protected]>
---
drivers/staging/nvec/nvec_paz00.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/staging/nvec/nvec_paz00.c b/drivers/staging/nvec/nvec_paz00.c
index 55d59840fca4..9c01c51f0ab5 100644
--- a/drivers/staging/nvec/nvec_paz00.c
+++ b/drivers/staging/nvec/nvec_paz00.c
@@ -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;
--
2.34.1



2023-08-10 06:33:36

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH] staging: nvec: paz00: remove unneeded call to platform_set_drvdata()

On Wed, Aug 09, 2023 at 06:42:11PM +0300, Andrei Coardos wrote:
> 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.
>
> Signed-off-by: Andrei Coardos <[email protected]>
> ---

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


2023-10-10 16:14:16

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH] staging: nvec: paz00: remove unneeded call to platform_set_drvdata()

On Wed, Aug 09, 2023 at 06:42:11PM +0300, Andrei Coardos wrote:
> 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.
>
> Signed-off-by: Andrei Coardos <[email protected]>
> ---
> 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:

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (607.00 B)
signature.asc (849.00 B)
Download all attachments