Message ID | 20240531085749.42863-1-marex@denx.de (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | hwrng: stm32 - use sizeof(*priv) instead of sizeof(struct stm32_rng_private) | expand |
On Fri, May 31, 2024 at 10:57:34AM +0200, Marek Vasut wrote: > Use sizeof(*priv) instead of sizeof(struct stm32_rng_private), the > former makes renaming of struct stm32_rng_private easier if necessary, > as it removes one site where such rename has to happen. No functional > change. IMHO the main upside is that it's easier to spot that the allocation size is correct. Acked-by: Uwe Kleine-König <ukleinek@kernel.org> Best regards Uwe
Hi Marek, On 5/31/24 10:57, Marek Vasut wrote: > Use sizeof(*priv) instead of sizeof(struct stm32_rng_private), the > former makes renaming of struct stm32_rng_private easier if necessary, > as it removes one site where such rename has to happen. No functional > change. > > Signed-off-by: Marek Vasut <marex@denx.de> > --- > Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Gatien Chevallier <gatien.chevallier@foss.st.com> > Cc: Herbert Xu <herbert@gondor.apana.org.au> > Cc: Marek Vasut <marex@denx.de> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Olivia Mackall <olivia@selenic.com> > Cc: Rob Herring <robh@kernel.org> > Cc: Yang Yingliang <yangyingliang@huawei.com> > Cc: kernel@dh-electronics.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-crypto@vger.kernel.org > Cc: linux-stm32@st-md-mailman.stormreply.com > --- > drivers/char/hw_random/stm32-rng.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c > index d08c870eb8d1f..9d041a67c295a 100644 > --- a/drivers/char/hw_random/stm32-rng.c > +++ b/drivers/char/hw_random/stm32-rng.c > @@ -517,7 +517,7 @@ static int stm32_rng_probe(struct platform_device *ofdev) > struct stm32_rng_private *priv; > struct resource *res; > > - priv = devm_kzalloc(dev, sizeof(struct stm32_rng_private), GFP_KERNEL); > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); > if (!priv) > return -ENOMEM; > Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Thanks, Gatien
On Fri, May 31, 2024 at 10:57:34AM +0200, Marek Vasut wrote: > Use sizeof(*priv) instead of sizeof(struct stm32_rng_private), the > former makes renaming of struct stm32_rng_private easier if necessary, > as it removes one site where such rename has to happen. No functional > change. > > Signed-off-by: Marek Vasut <marex@denx.de> > --- > Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> > Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> > Cc: Gatien Chevallier <gatien.chevallier@foss.st.com> > Cc: Herbert Xu <herbert@gondor.apana.org.au> > Cc: Marek Vasut <marex@denx.de> > Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> > Cc: Olivia Mackall <olivia@selenic.com> > Cc: Rob Herring <robh@kernel.org> > Cc: Yang Yingliang <yangyingliang@huawei.com> > Cc: kernel@dh-electronics.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-crypto@vger.kernel.org > Cc: linux-stm32@st-md-mailman.stormreply.com > --- > drivers/char/hw_random/stm32-rng.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Patch applied. Thanks.
diff --git a/drivers/char/hw_random/stm32-rng.c b/drivers/char/hw_random/stm32-rng.c index d08c870eb8d1f..9d041a67c295a 100644 --- a/drivers/char/hw_random/stm32-rng.c +++ b/drivers/char/hw_random/stm32-rng.c @@ -517,7 +517,7 @@ static int stm32_rng_probe(struct platform_device *ofdev) struct stm32_rng_private *priv; struct resource *res; - priv = devm_kzalloc(dev, sizeof(struct stm32_rng_private), GFP_KERNEL); + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM;
Use sizeof(*priv) instead of sizeof(struct stm32_rng_private), the former makes renaming of struct stm32_rng_private easier if necessary, as it removes one site where such rename has to happen. No functional change. Signed-off-by: Marek Vasut <marex@denx.de> --- Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Gatien Chevallier <gatien.chevallier@foss.st.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Marek Vasut <marex@denx.de> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Olivia Mackall <olivia@selenic.com> Cc: Rob Herring <robh@kernel.org> Cc: Yang Yingliang <yangyingliang@huawei.com> Cc: kernel@dh-electronics.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-crypto@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com --- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)