* [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() @ 2023-08-28 10:17 Andrei Coardos 2023-08-28 11:03 ` Conor Dooley 2023-09-15 10:38 ` Herbert Xu 0 siblings, 2 replies; 5+ messages in thread From: Andrei Coardos @ 2023-08-28 10:17 UTC (permalink / raw) To: linux-kernel, linux-crypto, linux-riscv Cc: alex, herbert, olivia, daire.mcnamara, conor.dooley, 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. Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> --- drivers/char/hw_random/mpfs-rng.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/char/hw_random/mpfs-rng.c b/drivers/char/hw_random/mpfs-rng.c index c6972734ae62..0994024daa70 100644 --- a/drivers/char/hw_random/mpfs-rng.c +++ b/drivers/char/hw_random/mpfs-rng.c @@ -79,8 +79,6 @@ static int mpfs_rng_probe(struct platform_device *pdev) rng_priv->rng.read = mpfs_rng_read; rng_priv->rng.name = pdev->name; - platform_set_drvdata(pdev, rng_priv); - ret = devm_hwrng_register(&pdev->dev, &rng_priv->rng); if (ret) return dev_err_probe(&pdev->dev, ret, "Failed to register MPFS hwrng\n"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() 2023-08-28 10:17 [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() Andrei Coardos @ 2023-08-28 11:03 ` Conor Dooley 2023-09-01 6:07 ` Alexandru Ardelean 2023-09-15 10:38 ` Herbert Xu 1 sibling, 1 reply; 5+ messages in thread From: Conor Dooley @ 2023-08-28 11:03 UTC (permalink / raw) To: Andrei Coardos Cc: linux-kernel, linux-crypto, linux-riscv, alex, herbert, olivia, daire.mcnamara [-- Attachment #1: Type: text/plain, Size: 1421 bytes --] On Mon, Aug 28, 2023 at 01:17:57PM +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. I think Greg previously pointed out to you that is it not sufficient to check for platform_get_drvdata() alone, because the information could be accessed without going through that helper. That's not the case here, but it could be true elsewhere. Acked-by: Conor Dooley <conor.dooley@microchip.com> Thanks, Conor. > > Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> > --- > drivers/char/hw_random/mpfs-rng.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/char/hw_random/mpfs-rng.c b/drivers/char/hw_random/mpfs-rng.c > index c6972734ae62..0994024daa70 100644 > --- a/drivers/char/hw_random/mpfs-rng.c > +++ b/drivers/char/hw_random/mpfs-rng.c > @@ -79,8 +79,6 @@ static int mpfs_rng_probe(struct platform_device *pdev) > rng_priv->rng.read = mpfs_rng_read; > rng_priv->rng.name = pdev->name; > > - platform_set_drvdata(pdev, rng_priv); > - > ret = devm_hwrng_register(&pdev->dev, &rng_priv->rng); > if (ret) > return dev_err_probe(&pdev->dev, ret, "Failed to register MPFS hwrng\n"); > -- > 2.34.1 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() 2023-08-28 11:03 ` Conor Dooley @ 2023-09-01 6:07 ` Alexandru Ardelean 2023-09-01 6:25 ` Conor Dooley 0 siblings, 1 reply; 5+ messages in thread From: Alexandru Ardelean @ 2023-09-01 6:07 UTC (permalink / raw) To: Conor Dooley Cc: Andrei Coardos, linux-kernel, linux-crypto, linux-riscv, herbert, olivia, daire.mcnamara On Mon, Aug 28, 2023 at 2:06 PM Conor Dooley <conor.dooley@microchip.com> wrote: > > On Mon, Aug 28, 2023 at 01:17:57PM +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. > > I think Greg previously pointed out to you that is it not sufficient to > check for platform_get_drvdata() alone, because the information could be > accessed without going through that helper. That's not the case here, > but it could be true elsewhere. > > Acked-by: Conor Dooley <conor.dooley@microchip.com> > > Thanks, > Conor. > > > > > Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> > > --- > > drivers/char/hw_random/mpfs-rng.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/drivers/char/hw_random/mpfs-rng.c b/drivers/char/hw_random/mpfs-rng.c > > index c6972734ae62..0994024daa70 100644 > > --- a/drivers/char/hw_random/mpfs-rng.c > > +++ b/drivers/char/hw_random/mpfs-rng.c > > @@ -79,8 +79,6 @@ static int mpfs_rng_probe(struct platform_device *pdev) > > rng_priv->rng.read = mpfs_rng_read; > > rng_priv->rng.name = pdev->name; > > > > - platform_set_drvdata(pdev, rng_priv); > > - > > ret = devm_hwrng_register(&pdev->dev, &rng_priv->rng); A question would be if there is a desire to keep the prints below, or would this be sufficient? return devm_hwrng_register(&pdev->dev, &rng_priv->rng); If there is the desire to keep the prints, then: Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> > > if (ret) > > return dev_err_probe(&pdev->dev, ret, "Failed to register MPFS hwrng\n"); > > -- > > 2.34.1 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() 2023-09-01 6:07 ` Alexandru Ardelean @ 2023-09-01 6:25 ` Conor Dooley 0 siblings, 0 replies; 5+ messages in thread From: Conor Dooley @ 2023-09-01 6:25 UTC (permalink / raw) To: Alexandru Ardelean Cc: Andrei Coardos, linux-kernel, linux-crypto, linux-riscv, herbert, olivia, daire.mcnamara [-- Attachment #1: Type: text/plain, Size: 2116 bytes --] On Fri, Sep 01, 2023 at 09:07:56AM +0300, Alexandru Ardelean wrote: > On Mon, Aug 28, 2023 at 2:06 PM Conor Dooley <conor.dooley@microchip.com> wrote: > > > > On Mon, Aug 28, 2023 at 01:17:57PM +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. > > > > I think Greg previously pointed out to you that is it not sufficient to > > check for platform_get_drvdata() alone, because the information could be > > accessed without going through that helper. That's not the case here, > > but it could be true elsewhere. > > > > Acked-by: Conor Dooley <conor.dooley@microchip.com> > > > > Thanks, > > Conor. > > > > > > > > Signed-off-by: Andrei Coardos <aboutphysycs@gmail.com> > > > --- > > > drivers/char/hw_random/mpfs-rng.c | 2 -- > > > 1 file changed, 2 deletions(-) > > > > > > diff --git a/drivers/char/hw_random/mpfs-rng.c b/drivers/char/hw_random/mpfs-rng.c > > > index c6972734ae62..0994024daa70 100644 > > > --- a/drivers/char/hw_random/mpfs-rng.c > > > +++ b/drivers/char/hw_random/mpfs-rng.c > > > @@ -79,8 +79,6 @@ static int mpfs_rng_probe(struct platform_device *pdev) > > > rng_priv->rng.read = mpfs_rng_read; > > > rng_priv->rng.name = pdev->name; > > > > > > - platform_set_drvdata(pdev, rng_priv); > > > - > > > ret = devm_hwrng_register(&pdev->dev, &rng_priv->rng); > > A question would be if there is a desire to keep the prints below, or > would this be sufficient? > > return devm_hwrng_register(&pdev->dev, &rng_priv->rng); > > If there is the desire to keep the prints, then: Yeah, I'd like to keep a print in the failing case, thanks. > > Reviewed-by: Alexandru Ardelean <alex@shruggie.ro> > > > > if (ret) > > > return dev_err_probe(&pdev->dev, ret, "Failed to register MPFS hwrng\n"); > > > -- > > > 2.34.1 > > > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() 2023-08-28 10:17 [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() Andrei Coardos 2023-08-28 11:03 ` Conor Dooley @ 2023-09-15 10:38 ` Herbert Xu 1 sibling, 0 replies; 5+ messages in thread From: Herbert Xu @ 2023-09-15 10:38 UTC (permalink / raw) To: Andrei Coardos Cc: linux-kernel, linux-crypto, linux-riscv, alex, olivia, daire.mcnamara, conor.dooley On Mon, Aug 28, 2023 at 01:17:57PM +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 <aboutphysycs@gmail.com> > --- > drivers/char/hw_random/mpfs-rng.c | 2 -- > 1 file changed, 2 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-09-15 10:38 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-28 10:17 [PATCH] char: hw_random: mpfs-rng: removed unneeded call to platform_set_drvdata() Andrei Coardos 2023-08-28 11:03 ` Conor Dooley 2023-09-01 6:07 ` Alexandru Ardelean 2023-09-01 6:25 ` Conor Dooley 2023-09-15 10:38 ` Herbert Xu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox