* [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations
@ 2017-04-14 9:00 SF Markus Elfring
2017-04-14 9:03 ` SF Markus Elfring
` (9 more replies)
0 siblings, 10 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:00 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 10:45:43 +0200
Some update suggestions were taken into account
from static source code analysis.
Markus Elfring (10):
imx: Use kmalloc_array() in imx_dt_node_to_map()
imx: Use devm_kcalloc() in two functions
imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_functions()
imx: Improve another size determination in imx_pinctrl_parse_functions()
imx: Use devm_kmalloc_array() in imx_pinctrl_probe()
imx: Use seq_putc() in imx_pinconf_group_dbg_show()
imx: Use seq_puts() in imx_pinconf_dbg_show()
imx1-core: Use kmalloc_array() in imx_dt_node_to_map()
mxs: Use devm_kcalloc() in two functions
mxs: Use kcalloc() in mxs_dt_node_to_map()
drivers/pinctrl/freescale/pinctrl-imx.c | 31 +++++++++++++++------------
drivers/pinctrl/freescale/pinctrl-imx1-core.c | 2 +-
drivers/pinctrl/freescale/pinctrl-mxs.c | 13 +++++------
3 files changed, 25 insertions(+), 21 deletions(-)
--
2.12.2
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/10] pinctrl: imx: Use kmalloc_array() in imx_dt_node_to_map()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:03 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:03 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 10:50:11 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index a7ace9e1ad81..563d24e7989d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -98,7 +98,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
map_num++;
}
- new_map = kmalloc(sizeof(struct pinctrl_map) * map_num, GFP_KERNEL);
+ new_map = kmalloc_array(map_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 1/10] pinctrl: imx: Use kmalloc_array() in imx_dt_node_to_map()
@ 2017-04-14 9:03 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:03 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 10:50:11 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index a7ace9e1ad81..563d24e7989d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -98,7 +98,7 @@ static int imx_dt_node_to_map(struct pinctrl_dev *pctldev,
map_num++;
}
- new_map = kmalloc(sizeof(struct pinctrl_map) * map_num, GFP_KERNEL);
+ new_map = kmalloc_array(map_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/10] pinctrl: imx: Use devm_kcalloc() in two functions
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:07 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:07 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 14:13:00 +0200
* Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of data types by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 563d24e7989d..975ed40cb774 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -509,10 +509,10 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
}
grp->num_pins = size / pin_size;
- grp->data = devm_kzalloc(info->dev, grp->num_pins *
+ grp->data = devm_kcalloc(info->dev, grp->num_pins,
sizeof(struct imx_pin), GFP_KERNEL);
- grp->pins = devm_kzalloc(info->dev, grp->num_pins *
- sizeof(unsigned int), GFP_KERNEL);
+ grp->pins = devm_kcalloc(info->dev, grp->num_pins,
+ sizeof(*grp->pins), GFP_KERNEL);
if (!grp->pins || !grp->data)
return -ENOMEM;
@@ -581,9 +581,10 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
dev_err(info->dev, "no groups defined in %s\n", np->full_name);
return -EINVAL;
}
- func->group_names = devm_kzalloc(info->dev,
- func->num_group_names *
- sizeof(char *), GFP_KERNEL);
+ func->group_names = devm_kcalloc(info->dev,
+ func->num_group_names,
+ sizeof(*func->group_names),
+ GFP_KERNEL);
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/10] pinctrl: imx: Use devm_kcalloc() in two functions
@ 2017-04-14 9:07 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:07 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 14:13:00 +0200
* Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".
This issue was detected by using the Coccinelle software.
* Replace the specification of data types by pointer dereferences
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 563d24e7989d..975ed40cb774 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -509,10 +509,10 @@ static int imx_pinctrl_parse_groups(struct device_node *np,
}
grp->num_pins = size / pin_size;
- grp->data = devm_kzalloc(info->dev, grp->num_pins *
+ grp->data = devm_kcalloc(info->dev, grp->num_pins,
sizeof(struct imx_pin), GFP_KERNEL);
- grp->pins = devm_kzalloc(info->dev, grp->num_pins *
- sizeof(unsigned int), GFP_KERNEL);
+ grp->pins = devm_kcalloc(info->dev, grp->num_pins,
+ sizeof(*grp->pins), GFP_KERNEL);
if (!grp->pins || !grp->data)
return -ENOMEM;
@@ -581,9 +581,10 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
dev_err(info->dev, "no groups defined in %s\n", np->full_name);
return -EINVAL;
}
- func->group_names = devm_kzalloc(info->dev,
- func->num_group_names *
- sizeof(char *), GFP_KERNEL);
+ func->group_names = devm_kcalloc(info->dev,
+ func->num_group_names,
+ sizeof(*func->group_names),
+ GFP_KERNEL);
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/10] pinctrl: imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_functions()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:11 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:11 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:12:20 +0200
Add a check for a null pointer and return an error code
after a memory allocation failure was detected.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 975ed40cb774..f835e8210ace 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -585,6 +585,8 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
func->num_group_names,
sizeof(*func->group_names),
GFP_KERNEL);
+ if (!func->group_names)
+ return -ENOMEM;
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/10] pinctrl: imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_funct
@ 2017-04-14 9:11 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:11 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:12:20 +0200
Add a check for a null pointer and return an error code
after a memory allocation failure was detected.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 975ed40cb774..f835e8210ace 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -585,6 +585,8 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
func->num_group_names,
sizeof(*func->group_names),
GFP_KERNEL);
+ if (!func->group_names)
+ return -ENOMEM;
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/10] pinctrl: imx: Improve another size determination in imx_pinctrl_parse_functions()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:14 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:14 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:20:43 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index f835e8210ace..44dbf6e38d79 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -590,9 +590,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
-
- grp = devm_kzalloc(info->dev, sizeof(struct group_desc),
- GFP_KERNEL);
+ grp = devm_kzalloc(info->dev, sizeof(*grp), GFP_KERNEL);
if (!grp)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/10] pinctrl: imx: Improve another size determination in imx_pinctrl_parse_functions()
@ 2017-04-14 9:14 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:14 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:20:43 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index f835e8210ace..44dbf6e38d79 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -590,9 +590,7 @@ static int imx_pinctrl_parse_functions(struct device_node *np,
for_each_child_of_node(np, child) {
func->group_names[i] = child->name;
-
- grp = devm_kzalloc(info->dev, sizeof(struct group_desc),
- GFP_KERNEL);
+ grp = devm_kzalloc(info->dev, sizeof(*grp), GFP_KERNEL);
if (!grp)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/10] pinctrl: imx: Use devm_kmalloc_array() in imx_pinctrl_probe()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:15 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:15 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:35:27 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 44dbf6e38d79..078875361d76 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -726,8 +726,10 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (!ipctl)
return -ENOMEM;
- info->pin_regs = devm_kmalloc(&pdev->dev, sizeof(*info->pin_regs) *
- info->npins, GFP_KERNEL);
+ info->pin_regs = devm_kmalloc_array(&pdev->dev,
+ info->npins,
+ sizeof(*info->pin_regs),
+ GFP_KERNEL);
if (!info->pin_regs)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/10] pinctrl: imx: Use devm_kmalloc_array() in imx_pinctrl_probe()
@ 2017-04-14 9:15 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:15 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:35:27 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 44dbf6e38d79..078875361d76 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -726,8 +726,10 @@ int imx_pinctrl_probe(struct platform_device *pdev,
if (!ipctl)
return -ENOMEM;
- info->pin_regs = devm_kmalloc(&pdev->dev, sizeof(*info->pin_regs) *
- info->npins, GFP_KERNEL);
+ info->pin_regs = devm_kmalloc_array(&pdev->dev,
+ info->npins,
+ sizeof(*info->pin_regs),
+ GFP_KERNEL);
if (!info->pin_regs)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/10] pinctrl: imx: Use seq_putc() in imx_pinconf_group_dbg_show()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:17 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:17 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:43:55 +0200
A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 078875361d76..71dbba892e70 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -443,7 +443,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
if (group > pctldev->num_groups)
return;
- seq_printf(s, "\n");
+ seq_putc(s, '\n');
grp = pinctrl_generic_get_group(pctldev, group);
if (!grp)
return;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/10] pinctrl: imx: Use seq_putc() in imx_pinconf_group_dbg_show()
@ 2017-04-14 9:17 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:17 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:43:55 +0200
A single character (line break) should be put into a sequence.
Thus use the corresponding function "seq_putc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 078875361d76..71dbba892e70 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -443,7 +443,7 @@ static void imx_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
if (group > pctldev->num_groups)
return;
- seq_printf(s, "\n");
+ seq_putc(s, '\n');
grp = pinctrl_generic_get_group(pctldev, group);
if (!grp)
return;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/10] pinctrl: imx: Use seq_puts() in imx_pinconf_dbg_show()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:19 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:19 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:50:58 +0200
A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 71dbba892e70..c6bfabcd577a 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -424,7 +424,7 @@ static void imx_pinconf_dbg_show(struct pinctrl_dev *pctldev,
unsigned long config;
if (!pin_reg || pin_reg->conf_reg == -1) {
- seq_printf(s, "N/A");
+ seq_puts(s, "N/A");
return;
}
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/10] pinctrl: imx: Use seq_puts() in imx_pinconf_dbg_show()
@ 2017-04-14 9:19 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:19 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 15:50:58 +0200
A string which did not contain a data format specification should be put
into a sequence. Thus use the corresponding function "seq_puts".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx.c b/drivers/pinctrl/freescale/pinctrl-imx.c
index 71dbba892e70..c6bfabcd577a 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx.c
@@ -424,7 +424,7 @@ static void imx_pinconf_dbg_show(struct pinctrl_dev *pctldev,
unsigned long config;
if (!pin_reg || pin_reg->conf_reg = -1) {
- seq_printf(s, "N/A");
+ seq_puts(s, "N/A");
return;
}
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/10] pinctrl: imx1-core: Use kmalloc_array() in imx_dt_node_to_map()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:20 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:20 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 16:10:33 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx1-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
index a4e9f430d452..5a0d221ed09d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
@@ -246,7 +246,7 @@ static int imx1_dt_node_to_map(struct pinctrl_dev *pctldev,
for (i = 0; i < grp->npins; i++)
map_num++;
- new_map = kmalloc(sizeof(struct pinctrl_map) * map_num, GFP_KERNEL);
+ new_map = kmalloc_array(map_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/10] pinctrl: imx1-core: Use kmalloc_array() in imx_dt_node_to_map()
@ 2017-04-14 9:20 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:20 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 16:10:33 +0200
* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-imx1-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-imx1-core.c b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
index a4e9f430d452..5a0d221ed09d 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx1-core.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx1-core.c
@@ -246,7 +246,7 @@ static int imx1_dt_node_to_map(struct pinctrl_dev *pctldev,
for (i = 0; i < grp->npins; i++)
map_num++;
- new_map = kmalloc(sizeof(struct pinctrl_map) * map_num, GFP_KERNEL);
+ new_map = kmalloc_array(map_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/10] pinctrl: mxs: Use devm_kcalloc() in two functions
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:22 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:22 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 16:28:48 +0200
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-mxs.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 41b5b07d5a2b..9e6dc0038c35 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -369,12 +369,12 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev,
return -EINVAL;
g->npins = length / sizeof(u32);
- g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins),
+ g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins),
GFP_KERNEL);
if (!g->pins)
return -ENOMEM;
- g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel),
+ g->muxsel = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->muxsel),
GFP_KERNEL);
if (!g->muxsel)
return -ENOMEM;
@@ -425,12 +425,12 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
}
}
- soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions *
+ soc->functions = devm_kcalloc(&pdev->dev, soc->nfunctions,
sizeof(*soc->functions), GFP_KERNEL);
if (!soc->functions)
return -ENOMEM;
- soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups *
+ soc->groups = devm_kcalloc(&pdev->dev, soc->ngroups,
sizeof(*soc->groups), GFP_KERNEL);
if (!soc->groups)
return -ENOMEM;
@@ -491,7 +491,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
if (strcmp(fn, child->name)) {
f = &soc->functions[idxf++];
- f->groups = devm_kzalloc(&pdev->dev, f->ngroups *
+ f->groups = devm_kcalloc(&pdev->dev,
+ f->ngroups,
sizeof(*f->groups),
GFP_KERNEL);
if (!f->groups)
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/10] pinctrl: mxs: Use devm_kcalloc() in two functions
@ 2017-04-14 9:22 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:22 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 13 Apr 2017 16:28:48 +0200
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-mxs.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 41b5b07d5a2b..9e6dc0038c35 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -369,12 +369,12 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev,
return -EINVAL;
g->npins = length / sizeof(u32);
- g->pins = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->pins),
+ g->pins = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->pins),
GFP_KERNEL);
if (!g->pins)
return -ENOMEM;
- g->muxsel = devm_kzalloc(&pdev->dev, g->npins * sizeof(*g->muxsel),
+ g->muxsel = devm_kcalloc(&pdev->dev, g->npins, sizeof(*g->muxsel),
GFP_KERNEL);
if (!g->muxsel)
return -ENOMEM;
@@ -425,12 +425,12 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
}
}
- soc->functions = devm_kzalloc(&pdev->dev, soc->nfunctions *
+ soc->functions = devm_kcalloc(&pdev->dev, soc->nfunctions,
sizeof(*soc->functions), GFP_KERNEL);
if (!soc->functions)
return -ENOMEM;
- soc->groups = devm_kzalloc(&pdev->dev, soc->ngroups *
+ soc->groups = devm_kcalloc(&pdev->dev, soc->ngroups,
sizeof(*soc->groups), GFP_KERNEL);
if (!soc->groups)
return -ENOMEM;
@@ -491,7 +491,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
if (strcmp(fn, child->name)) {
f = &soc->functions[idxf++];
- f->groups = devm_kzalloc(&pdev->dev, f->ngroups *
+ f->groups = devm_kcalloc(&pdev->dev,
+ f->ngroups,
sizeof(*f->groups),
GFP_KERNEL);
if (!f->groups)
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map()
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
@ 2017-04-14 9:23 ` SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
` (8 subsequent siblings)
9 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:23 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 10:32:29 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-mxs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 9e6dc0038c35..1479610091d5 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -96,7 +96,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
if (!purecfg && config)
new_num = 2;
- new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL);
+ new_map = kcalloc(new_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map()
@ 2017-04-14 9:23 ` SF Markus Elfring
0 siblings, 0 replies; 21+ messages in thread
From: SF Markus Elfring @ 2017-04-14 9:23 UTC (permalink / raw)
To: linux-gpio, Arnd Bergmann, Gary Bisson, Laxman Dewangan,
Linus Walleij, Paul Gortmaker, Peng Fan, Shawn Guo,
Vladimir Zapolskiy
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 14 Apr 2017 10:32:29 +0200
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus reuse the corresponding function "kcalloc".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/freescale/pinctrl-mxs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/freescale/pinctrl-mxs.c b/drivers/pinctrl/freescale/pinctrl-mxs.c
index 9e6dc0038c35..1479610091d5 100644
--- a/drivers/pinctrl/freescale/pinctrl-mxs.c
+++ b/drivers/pinctrl/freescale/pinctrl-mxs.c
@@ -96,7 +96,7 @@ static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
if (!purecfg && config)
new_num = 2;
- new_map = kzalloc(sizeof(*new_map) * new_num, GFP_KERNEL);
+ new_map = kcalloc(new_num, sizeof(*new_map), GFP_KERNEL);
if (!new_map)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 21+ messages in thread
end of thread, other threads:[~2017-04-14 9:23 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 9:00 [PATCH 00/10] pinctrl: freescale: Fine-tuning for ten function implementations SF Markus Elfring
2017-04-14 9:03 ` [PATCH 1/10] pinctrl: imx: Use kmalloc_array() in imx_dt_node_to_map() SF Markus Elfring
2017-04-14 9:03 ` SF Markus Elfring
2017-04-14 9:07 ` [PATCH 02/10] pinctrl: imx: Use devm_kcalloc() in two functions SF Markus Elfring
2017-04-14 9:07 ` SF Markus Elfring
2017-04-14 9:11 ` [PATCH 03/10] pinctrl: imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_functions() SF Markus Elfring
2017-04-14 9:11 ` [PATCH 03/10] pinctrl: imx: Return directly after a failed devm_kcalloc() in imx_pinctrl_parse_funct SF Markus Elfring
2017-04-14 9:14 ` [PATCH 04/10] pinctrl: imx: Improve another size determination in imx_pinctrl_parse_functions() SF Markus Elfring
2017-04-14 9:14 ` SF Markus Elfring
2017-04-14 9:15 ` [PATCH 05/10] pinctrl: imx: Use devm_kmalloc_array() in imx_pinctrl_probe() SF Markus Elfring
2017-04-14 9:15 ` SF Markus Elfring
2017-04-14 9:17 ` [PATCH 06/10] pinctrl: imx: Use seq_putc() in imx_pinconf_group_dbg_show() SF Markus Elfring
2017-04-14 9:17 ` SF Markus Elfring
2017-04-14 9:19 ` [PATCH 07/10] pinctrl: imx: Use seq_puts() in imx_pinconf_dbg_show() SF Markus Elfring
2017-04-14 9:19 ` SF Markus Elfring
2017-04-14 9:20 ` [PATCH 08/10] pinctrl: imx1-core: Use kmalloc_array() in imx_dt_node_to_map() SF Markus Elfring
2017-04-14 9:20 ` SF Markus Elfring
2017-04-14 9:22 ` [PATCH 09/10] pinctrl: mxs: Use devm_kcalloc() in two functions SF Markus Elfring
2017-04-14 9:22 ` SF Markus Elfring
2017-04-14 9:23 ` [PATCH 10/10] pinctrl: mxs: Use kcalloc() in mxs_dt_node_to_map() SF Markus Elfring
2017-04-14 9:23 ` SF Markus Elfring
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.