summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@linaro.org>2025-04-09 21:37:41 +0100
committerLee Jones <lee@kernel.org>2025-05-23 08:48:47 +0100
commit2b897a1c2b667fce1fd9dcf318dbab5992c3e506 (patch)
tree16a38e33d8c68340ece7e7cc4ea1a7e79d167f92
parent856c6514d5ab491a5ad4be6e797d0d5283ad51aa (diff)
mfd: sec-common: Use sizeof(*var), not sizeof(struct type_of_var)
Using sizeof(*var) is generally preferred over using the size of its open-coded type when allocating memory. This helps avoiding bugs when the variable type changes but the memory allocation isn't updated, and it simplifies renaming of the struct if ever necessary. No functional change. Signed-off-by: André Draszik <andre.draszik@linaro.org> Link: https://lore.kernel.org/r/20250409-s2mpg10-v4-20-d66d5f39b6bf@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
-rw-r--r--drivers/mfd/sec-common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/sec-common.c b/drivers/mfd/sec-common.c
index 55edeb0f73ff..e8e35f7d5f06 100644
--- a/drivers/mfd/sec-common.c
+++ b/drivers/mfd/sec-common.c
@@ -163,7 +163,7 @@ int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
struct sec_pmic_dev *sec_pmic;
int ret, num_sec_devs;
- sec_pmic = devm_kzalloc(dev, sizeof(struct sec_pmic_dev), GFP_KERNEL);
+ sec_pmic = devm_kzalloc(dev, sizeof(*sec_pmic), GFP_KERNEL);
if (!sec_pmic)
return -ENOMEM;