* [PATCH 0/3] Input: Fine-tuning for six function implementations
@ 2017-05-08 13:03 SF Markus Elfring
2017-05-08 13:04 ` [PATCH 1/3] Input: Use seq_putc() in input_seq_print_bitmap() SF Markus Elfring
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08 13:03 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 15:00:15 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Use seq_putc() in input_seq_print_bitmap()
Use seq_puts() in input_devices_seq_show()
Improve a size determination in four functions
drivers/input/input.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--
2.12.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/3] Input: Use seq_putc() in input_seq_print_bitmap()
2017-05-08 13:03 [PATCH 0/3] Input: Fine-tuning for six function implementations SF Markus Elfring
@ 2017-05-08 13:04 ` SF Markus Elfring
2017-05-08 13:05 ` [PATCH 2/3] Input: Use seq_puts() in input_devices_seq_show() SF Markus Elfring
2017-05-08 13:06 ` [PATCH 3/3] Input: Improve a size determination in four functions SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08 13:04 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 14:20:18 +0200
A single character 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/input/input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 067d648028a2..0d204b841575 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1126,7 +1126,7 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
* If no output was produced print a single 0.
*/
if (skip_empty)
- seq_puts(seq, "0");
+ seq_putc(seq, '0');
seq_putc(seq, '\n');
}
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/3] Input: Use seq_puts() in input_devices_seq_show()
2017-05-08 13:03 [PATCH 0/3] Input: Fine-tuning for six function implementations SF Markus Elfring
2017-05-08 13:04 ` [PATCH 1/3] Input: Use seq_putc() in input_seq_print_bitmap() SF Markus Elfring
@ 2017-05-08 13:05 ` SF Markus Elfring
2017-05-08 13:06 ` [PATCH 3/3] Input: Improve a size determination in four functions SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08 13:05 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 14:30:03 +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/input/input.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 0d204b841575..067a6edd643c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1144,7 +1144,7 @@ static int input_devices_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, "P: Phys=%s\n", dev->phys ? dev->phys : "");
seq_printf(seq, "S: Sysfs=%s\n", path ? path : "");
seq_printf(seq, "U: Uniq=%s\n", dev->uniq ? dev->uniq : "");
- seq_printf(seq, "H: Handlers=");
+ seq_puts(seq, "H: Handlers=");
list_for_each_entry(handle, &dev->h_list, d_node)
seq_printf(seq, "%s ", handle->name);
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 3/3] Input: Improve a size determination in four functions
2017-05-08 13:03 [PATCH 0/3] Input: Fine-tuning for six function implementations SF Markus Elfring
2017-05-08 13:04 ` [PATCH 1/3] Input: Use seq_putc() in input_seq_print_bitmap() SF Markus Elfring
2017-05-08 13:05 ` [PATCH 2/3] Input: Use seq_puts() in input_devices_seq_show() SF Markus Elfring
@ 2017-05-08 13:06 ` SF Markus Elfring
2 siblings, 0 replies; 4+ messages in thread
From: SF Markus Elfring @ 2017-05-08 13:06 UTC (permalink / raw)
To: linux-input, Dmitry Torokhov; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 8 May 2017 14:54:26 +0200
Replace the specification of four data structures by pointer dereferences
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/input/input.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 067a6edd643c..7e6842bd525c 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -481,7 +481,7 @@ EXPORT_SYMBOL(input_inject_event);
void input_alloc_absinfo(struct input_dev *dev)
{
if (!dev->absinfo)
- dev->absinfo = kcalloc(ABS_CNT, sizeof(struct input_absinfo),
+ dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo),
GFP_KERNEL);
WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__);
@@ -1783,7 +1783,7 @@ struct input_dev *input_allocate_device(void)
static atomic_t input_no = ATOMIC_INIT(-1);
struct input_dev *dev;
- dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (dev) {
dev->dev.type = &input_dev_type;
dev->dev.class = &input_class;
@@ -1849,7 +1849,7 @@ struct input_dev *devm_input_allocate_device(struct device *dev)
struct input_devres *devres;
devres = devres_alloc(devm_input_device_release,
- sizeof(struct input_devres), GFP_KERNEL);
+ sizeof(*devres), GFP_KERNEL);
if (!devres)
return NULL;
@@ -2099,7 +2099,7 @@ int input_register_device(struct input_dev *dev)
if (dev->devres_managed) {
devres = devres_alloc(devm_input_device_unregister,
- sizeof(struct input_devres), GFP_KERNEL);
+ sizeof(*devres), GFP_KERNEL);
if (!devres)
return -ENOMEM;
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-08 13:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-08 13:03 [PATCH 0/3] Input: Fine-tuning for six function implementations SF Markus Elfring
2017-05-08 13:04 ` [PATCH 1/3] Input: Use seq_putc() in input_seq_print_bitmap() SF Markus Elfring
2017-05-08 13:05 ` [PATCH 2/3] Input: Use seq_puts() in input_devices_seq_show() SF Markus Elfring
2017-05-08 13:06 ` [PATCH 3/3] Input: Improve a size determination in four functions SF Markus Elfring
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).