From: Bartosz Golaszewski <[email protected]>

It's better to use the size of the actual variable than its type when
allocating memory. This also has the benefit of avoiding a line break
here.

Signed-off-by: Bartosz Golaszewski <[email protected]>
---
 samples/configfs/configfs_sample.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/samples/configfs/configfs_sample.c 
b/samples/configfs/configfs_sample.c
index 20bf3b3e0f0f..220aee7075b6 100644
--- a/samples/configfs/configfs_sample.c
+++ b/samples/configfs/configfs_sample.c
@@ -185,7 +185,7 @@ static struct config_item *simple_children_make_item(struct 
config_group *group,
 {
        struct simple_child *simple_child;
 
-       simple_child = kzalloc(sizeof(struct simple_child), GFP_KERNEL);
+       simple_child = kzalloc(sizeof(*simple_child), GFP_KERNEL);
        if (!simple_child)
                return ERR_PTR(-ENOMEM);
 
@@ -262,8 +262,7 @@ group_children_make_group(struct config_group *group, const 
char *name)
 {
        struct simple_children *simple_children;
 
-       simple_children = kzalloc(sizeof(struct simple_children),
-                                 GFP_KERNEL);
+       simple_children = kzalloc(sizeof(*simple_children), GFP_KERNEL);
        if (!simple_children)
                return ERR_PTR(-ENOMEM);
 
-- 
2.17.1

Reply via email to