* [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations
@ 2017-01-12 16:30 SF Markus Elfring
2017-01-12 16:31 ` [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map() SF Markus Elfring
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:30 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 17:25:17 +0100
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (5):
Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map()
Delete an error message for a failed memory allocation in three functions
Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show()
Use seq_puts() in mvebu_pinconf_group_dbg_show()
Use seq_putc() in mvebu_pinconf_group_dbg_show()
drivers/pinctrl/mvebu/pinctrl-mvebu.c | 42 ++++++++++++++---------------------
1 file changed, 17 insertions(+), 25 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map()
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
@ 2017-01-12 16:31 ` SF Markus Elfring
2017-01-17 14:54 ` Linus Walleij
2017-01-12 16:33 ` [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:31 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 16:00:15 +0100
* 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/mvebu/pinctrl-mvebu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index b6ec6db78351..c2f74572ac01 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -398,7 +398,7 @@ static int mvebu_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
return 0;
}
- *map = kmalloc(nmaps * sizeof(struct pinctrl_map), GFP_KERNEL);
+ *map = kmalloc_array(nmaps, sizeof(**map), GFP_KERNEL);
if (*map == NULL) {
dev_err(pctl->dev,
"cannot allocate pinctrl_map memory for %s\n",
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
2017-01-12 16:31 ` [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map() SF Markus Elfring
@ 2017-01-12 16:33 ` SF Markus Elfring
2017-01-17 14:54 ` Linus Walleij
2017-01-12 16:34 ` [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show() SF Markus Elfring
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:33 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni, Wolfram Sang
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 16:15:34 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: Possible unnecessary 'out of memory' message
Thus fix the affected source code places.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/mvebu/pinctrl-mvebu.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index c2f74572ac01..0618311e75dc 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -399,12 +399,8 @@ static int mvebu_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
}
*map = kmalloc_array(nmaps, sizeof(**map), GFP_KERNEL);
- if (*map == NULL) {
- dev_err(pctl->dev,
- "cannot allocate pinctrl_map memory for %s\n",
- np->name);
+ if (!*map)
return -ENOMEM;
- }
n = 0;
of_property_for_each_string(np, "marvell,pins", prop, group) {
@@ -563,10 +559,8 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl),
GFP_KERNEL);
- if (!pctl) {
- dev_err(&pdev->dev, "unable to alloc driver\n");
+ if (!pctl)
return -ENOMEM;
- }
pctl->desc.name = dev_name(&pdev->dev);
pctl->desc.owner = THIS_MODULE;
@@ -604,10 +598,8 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
pdesc = devm_kzalloc(&pdev->dev, pctl->desc.npins *
sizeof(struct pinctrl_pin_desc), GFP_KERNEL);
- if (!pdesc) {
- dev_err(&pdev->dev, "failed to alloc pinctrl pins\n");
+ if (!pdesc)
return -ENOMEM;
- }
for (n = 0; n < pctl->desc.npins; n++)
pdesc[n].number = n;
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show()
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
2017-01-12 16:31 ` [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map() SF Markus Elfring
2017-01-12 16:33 ` [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2017-01-12 16:34 ` SF Markus Elfring
2017-01-17 14:55 ` Linus Walleij
2017-01-12 16:36 ` [PATCH 4/5] pinctrl: mvebu: Use seq_puts() " SF Markus Elfring
2017-01-12 16:37 ` [PATCH 5/5] pinctrl: mvebu: Use seq_putc() " SF Markus Elfring
4 siblings, 1 reply; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:34 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 16:30:24 +0100
The script "checkpatch.pl" pointed information out like the following.
WARNING: void function return statements are not generally useful
Thus remove such a statement in the affected function.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pinctrl/mvebu/pinctrl-mvebu.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 0618311e75dc..5b49bcda5e79 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -224,7 +224,6 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
}
seq_printf(s, " ]");
}
- return;
}
static const struct pinconf_ops mvebu_pinconf_ops = {
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/5] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show()
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
` (2 preceding siblings ...)
2017-01-12 16:34 ` [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show() SF Markus Elfring
@ 2017-01-12 16:36 ` SF Markus Elfring
2017-01-17 14:56 ` Linus Walleij
2017-01-12 16:37 ` [PATCH 5/5] pinctrl: mvebu: Use seq_putc() " SF Markus Elfring
4 siblings, 1 reply; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:36 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 16:51:00 +0100
Strings which did not contain data format specifications 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/mvebu/pinctrl-mvebu.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 5b49bcda5e79..5dc29ba128c4 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -195,11 +195,12 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
seq_printf(s, "o");
seq_printf(s, ")");
}
- } else
- seq_printf(s, "current: UNKNOWN");
+ } else {
+ seq_puts(s, "current: UNKNOWN");
+ }
if (grp->num_settings > 1) {
- seq_printf(s, ", available = [");
+ seq_puts(s, ", available = [");
for (n = 0; n < grp->num_settings; n++) {
if (curr == &grp->settings[n])
continue;
@@ -222,7 +223,7 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
seq_printf(s, ")");
}
}
- seq_printf(s, " ]");
+ seq_puts(s, " ]");
}
}
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/5] pinctrl: mvebu: Use seq_putc() in mvebu_pinconf_group_dbg_show()
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
` (3 preceding siblings ...)
2017-01-12 16:36 ` [PATCH 4/5] pinctrl: mvebu: Use seq_puts() " SF Markus Elfring
@ 2017-01-12 16:37 ` SF Markus Elfring
2017-01-17 14:57 ` Linus Walleij
4 siblings, 1 reply; 11+ messages in thread
From: SF Markus Elfring @ 2017-01-12 16:37 UTC (permalink / raw)
To: linux-gpio, Laxman Dewangan, Linus Walleij,
Sebastian Hesselbarth, Thomas Petazzoni
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 12 Jan 2017 17:12:30 +0100
Single characters 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/mvebu/pinctrl-mvebu.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 5dc29ba128c4..ff314aa823e7 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -188,12 +188,12 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
if (curr->subname)
seq_printf(s, "(%s)", curr->subname);
if (curr->flags & (MVEBU_SETTING_GPO | MVEBU_SETTING_GPI)) {
- seq_printf(s, "(");
+ seq_putc(s, '(');
if (curr->flags & MVEBU_SETTING_GPI)
- seq_printf(s, "i");
+ seq_putc(s, 'i');
if (curr->flags & MVEBU_SETTING_GPO)
- seq_printf(s, "o");
- seq_printf(s, ")");
+ seq_putc(s, 'o');
+ seq_putc(s, ')');
}
} else {
seq_puts(s, "current: UNKNOWN");
@@ -215,12 +215,12 @@ static void mvebu_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
seq_printf(s, "(%s)", grp->settings[n].subname);
if (grp->settings[n].flags &
(MVEBU_SETTING_GPO | MVEBU_SETTING_GPI)) {
- seq_printf(s, "(");
+ seq_putc(s, '(');
if (grp->settings[n].flags & MVEBU_SETTING_GPI)
- seq_printf(s, "i");
+ seq_putc(s, 'i');
if (grp->settings[n].flags & MVEBU_SETTING_GPO)
- seq_printf(s, "o");
- seq_printf(s, ")");
+ seq_putc(s, 'o');
+ seq_putc(s, ')');
}
}
seq_puts(s, " ]");
--
2.11.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map()
2017-01-12 16:31 ` [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map() SF Markus Elfring
@ 2017-01-17 14:54 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2017-01-17 14:54 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-gpio, Laxman Dewangan, Sebastian Hesselbarth,
Thomas Petazzoni, LKML, kernel-janitors
On Thu, Jan 12, 2017 at 5:31 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 12 Jan 2017 16:00:15 +0100
>
> * 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>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions
2017-01-12 16:33 ` [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2017-01-17 14:54 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2017-01-17 14:54 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-gpio, Laxman Dewangan, Sebastian Hesselbarth,
Thomas Petazzoni, Wolfram Sang, LKML, kernel-janitors
On Thu, Jan 12, 2017 at 5:33 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 12 Jan 2017 16:15:34 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: Possible unnecessary 'out of memory' message
>
> Thus fix the affected source code places.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show()
2017-01-12 16:34 ` [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show() SF Markus Elfring
@ 2017-01-17 14:55 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2017-01-17 14:55 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-gpio, Laxman Dewangan, Sebastian Hesselbarth,
Thomas Petazzoni, LKML, kernel-janitors
On Thu, Jan 12, 2017 at 5:34 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 12 Jan 2017 16:30:24 +0100
>
> The script "checkpatch.pl" pointed information out like the following.
>
> WARNING: void function return statements are not generally useful
>
> Thus remove such a statement in the affected function.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/5] pinctrl: mvebu: Use seq_puts() in mvebu_pinconf_group_dbg_show()
2017-01-12 16:36 ` [PATCH 4/5] pinctrl: mvebu: Use seq_puts() " SF Markus Elfring
@ 2017-01-17 14:56 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2017-01-17 14:56 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-gpio, Laxman Dewangan, Sebastian Hesselbarth,
Thomas Petazzoni, LKML, kernel-janitors
On Thu, Jan 12, 2017 at 5:36 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 12 Jan 2017 16:51:00 +0100
>
> Strings which did not contain data format specifications 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>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/5] pinctrl: mvebu: Use seq_putc() in mvebu_pinconf_group_dbg_show()
2017-01-12 16:37 ` [PATCH 5/5] pinctrl: mvebu: Use seq_putc() " SF Markus Elfring
@ 2017-01-17 14:57 ` Linus Walleij
0 siblings, 0 replies; 11+ messages in thread
From: Linus Walleij @ 2017-01-17 14:57 UTC (permalink / raw)
To: SF Markus Elfring
Cc: linux-gpio, Laxman Dewangan, Sebastian Hesselbarth,
Thomas Petazzoni, LKML, kernel-janitors
On Thu, Jan 12, 2017 at 5:37 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Thu, 12 Jan 2017 17:12:30 +0100
>
> Single characters 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>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2017-01-17 14:57 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-12 16:30 [PATCH 0/5] pinctrl-mvebu: Fine-tuning for four function implementations SF Markus Elfring
2017-01-12 16:31 ` [PATCH 1/5] pinctrl: mvebu: Use kmalloc_array() in mvebu_pinctrl_dt_node_to_map() SF Markus Elfring
2017-01-17 14:54 ` Linus Walleij
2017-01-12 16:33 ` [PATCH 2/5] pinctrl: mvebu: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
2017-01-17 14:54 ` Linus Walleij
2017-01-12 16:34 ` [PATCH 3/5] pinctrl: mvebu: Delete an unnecessary return statement in mvebu_pinconf_group_dbg_show() SF Markus Elfring
2017-01-17 14:55 ` Linus Walleij
2017-01-12 16:36 ` [PATCH 4/5] pinctrl: mvebu: Use seq_puts() " SF Markus Elfring
2017-01-17 14:56 ` Linus Walleij
2017-01-12 16:37 ` [PATCH 5/5] pinctrl: mvebu: Use seq_putc() " SF Markus Elfring
2017-01-17 14:57 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).