hwrng: stm32 - use sizeof(*priv) instead of sizeof(struct stm32_rng_private)
Subsystems (3)
PATCH 1/1 hwrng: stm32 - use sizeof(*priv) instead of sizeof(struct stm32_rng_private)
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.
---
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Olivia Mackall <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Yang Yingliang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/hw_random/stm32-rng.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0
Quoted 4 lines · Marek Vasut
Use
sizeof(*priv)instead ofsizeof(struct stm32_rng_private), the former makes renaming of structstm32_rng_privateeasier 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.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Hi Marek,
Quoted 29 lines · Marek Vasut
Use
sizeof(*priv)instead ofsizeof(struct stm32_rng_private), the former makes renaming of structstm32_rng_privateeasier if necessary, as it removes one site where such rename has to happen. No functional change.Signed-off-by Marek Vasut <[email protected]>---
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Olivia Mackall <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Yang Yingliang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/char/hw_random/stm32-rng.c +0
-0
drivers/char/hw_random/stm32-rng.c static int stm32_rng_probe(struct platform_device *ofdev) · line 523
Quoted 8 lines
drivers/char/hw_random/stm32-rng.c +1
-1@@ -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 ;
Thanks,
Gatien
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Herbert Xu
maintainerQuoted 20 lines · Marek Vasut
Use
sizeof(*priv)instead ofsizeof(struct stm32_rng_private), the former makes renaming of structstm32_rng_privateeasier if necessary, as it removes one site where such rename has to happen. No functional change.Signed-off-by Marek Vasut <[email protected]>---
Cc: "Uwe Kleine-König" <[email protected]>
Cc: Alexandre Torgue <[email protected]>
Cc: Gatien Chevallier <[email protected]>
Cc: Herbert Xu <[email protected]>
Cc: Marek Vasut <[email protected]>
Cc: Maxime Coquelin <[email protected]>
Cc: Olivia Mackall <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Yang Yingliang <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Quoted 3 lines
--- drivers/char/hw_random/stm32-rng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt