Skip to content

Commit 2b897a1

Browse files
andredlag-linaro
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 856c651 commit 2b897a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mfd/sec-common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ int sec_pmic_probe(struct device *dev, int device_type, unsigned int irq,
163163
struct sec_pmic_dev *sec_pmic;
164164
int ret, num_sec_devs;
165165

166-
sec_pmic = devm_kzalloc(dev, sizeof(struct sec_pmic_dev), GFP_KERNEL);
166+
sec_pmic = devm_kzalloc(dev, sizeof(*sec_pmic), GFP_KERNEL);
167167
if (!sec_pmic)
168168
return -ENOMEM;
169169

0 commit comments

Comments
 (0)