diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-04-11 14:48:23 +0300 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2023-05-29 23:41:29 +0900 |
commit | ef753fb4e86607afc6228d8632705122bc67f29a (patch) | |
tree | c793159807c08c491936a502673c384c05ab89a3 /drivers/extcon | |
parent | 7bba9e81a6fbf00daa4063c41da6b250d339f43b (diff) | |
download | lwn-ef753fb4e86607afc6228d8632705122bc67f29a.tar.gz lwn-ef753fb4e86607afc6228d8632705122bc67f29a.zip |
extcon: Use sizeof(*pointer) instead of sizeof(type)
It is preferred to use sizeof(*pointer) instead of sizeof(type).
The type of the variable can change and one needs not change
the former (unlike the latter). No functional change intended.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r-- | drivers/extcon/extcon.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 5da1cc60582a..76dc41e8f250 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1098,8 +1098,7 @@ static int extcon_alloc_cables(struct extcon_dev *edev) if (!edev->max_supported) return 0; - edev->cables = kcalloc(edev->max_supported, - sizeof(struct extcon_cable), + edev->cables = kcalloc(edev->max_supported, sizeof(*edev->cables), GFP_KERNEL); if (!edev->cables) return -ENOMEM; @@ -1161,14 +1160,12 @@ static int extcon_alloc_muex(struct extcon_dev *edev) for (index = 0; edev->mutually_exclusive[index]; index++) ; - edev->attrs_muex = kcalloc(index + 1, - sizeof(struct attribute *), + edev->attrs_muex = kcalloc(index + 1, sizeof(*edev->attrs_muex), GFP_KERNEL); if (!edev->attrs_muex) return -ENOMEM; - edev->d_attrs_muex = kcalloc(index, - sizeof(struct device_attribute), + edev->d_attrs_muex = kcalloc(index, sizeof(*edev->d_attrs_muex), GFP_KERNEL); if (!edev->d_attrs_muex) { kfree(edev->attrs_muex); @@ -1214,8 +1211,8 @@ static int extcon_alloc_groups(struct extcon_dev *edev) return 0; edev->extcon_dev_type.groups = kcalloc(edev->max_supported + 2, - sizeof(struct attribute_group *), - GFP_KERNEL); + sizeof(*edev->extcon_dev_type.groups), + GFP_KERNEL); if (!edev->extcon_dev_type.groups) return -ENOMEM; |