* [PATCH 0/2] Input: matrix_keypad: Adjustments for two function implementations
@ 2018-01-27 12:52 ` SF Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:52 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:48:42 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete two error messages for a failed memory allocation
in matrix_keypad_parse_dt()
Improve a size determination in matrix_keypad_probe()
drivers/input/keyboard/matrix_keypad.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 0/2] Input: matrix_keypad: Adjustments for two function implementations
@ 2018-01-27 12:52 ` SF Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:52 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:48:42 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete two error messages for a failed memory allocation
in matrix_keypad_parse_dt()
Improve a size determination in matrix_keypad_probe()
drivers/input/keyboard/matrix_keypad.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
--
2.16.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] Input: matrix_keypad: Delete two error messages for a failed memory allocation in matrix_keypad_parse_dt()
2018-01-27 12:52 ` SF Markus Elfring
@ 2018-01-27 12:53 ` SF Markus Elfring
-1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:53 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:35:02 +0100
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/keyboard/matrix_keypad.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 1f316d66e6f7..90238201a9cc 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -413,10 +413,8 @@ matrix_keypad_parse_dt(struct device *dev)
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(dev, "could not allocate memory for platform data\n");
+ if (!pdata)
return ERR_PTR(-ENOMEM);
- }
pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios");
pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios");
@@ -445,10 +443,8 @@ matrix_keypad_parse_dt(struct device *dev)
sizeof(unsigned int) *
(pdata->num_row_gpios + pdata->num_col_gpios),
GFP_KERNEL);
- if (!gpios) {
- dev_err(dev, "could not allocate memory for gpios\n");
+ if (!gpios)
return ERR_PTR(-ENOMEM);
- }
for (i = 0; i < pdata->num_row_gpios; i++)
gpios[i] = of_get_named_gpio(np, "row-gpios", i);
--
2.16.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/2] Input: matrix_keypad: Delete two error messages for a failed memory allocation in matrix
@ 2018-01-27 12:53 ` SF Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:53 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:35:02 +0100
Omit extra messages for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/keyboard/matrix_keypad.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 1f316d66e6f7..90238201a9cc 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -413,10 +413,8 @@ matrix_keypad_parse_dt(struct device *dev)
}
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(dev, "could not allocate memory for platform data\n");
+ if (!pdata)
return ERR_PTR(-ENOMEM);
- }
pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios");
pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios");
@@ -445,10 +443,8 @@ matrix_keypad_parse_dt(struct device *dev)
sizeof(unsigned int) *
(pdata->num_row_gpios + pdata->num_col_gpios),
GFP_KERNEL);
- if (!gpios) {
- dev_err(dev, "could not allocate memory for gpios\n");
+ if (!gpios)
return ERR_PTR(-ENOMEM);
- }
for (i = 0; i < pdata->num_row_gpios; i++)
gpios[i] = of_get_named_gpio(np, "row-gpios", i);
--
2.16.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Input: matrix_keypad: Improve a size determination in matrix_keypad_probe()
2018-01-27 12:52 ` SF Markus Elfring
@ 2018-01-27 12:54 ` SF Markus Elfring
-1 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:54 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:43:16 +0100
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.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/keyboard/matrix_keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 90238201a9cc..16206a8a5f07 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -487,7 +487,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}
- keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
+ keypad = kzalloc(sizeof(*keypad), GFP_KERNEL);
input_dev = input_allocate_device();
if (!keypad || !input_dev) {
err = -ENOMEM;
--
2.16.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] Input: matrix_keypad: Improve a size determination in matrix_keypad_probe()
@ 2018-01-27 12:54 ` SF Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: SF Markus Elfring @ 2018-01-27 12:54 UTC (permalink / raw)
To: linux-input, David Rivshin, Dmitry Torokhov, Rob Herring
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 27 Jan 2018 13:43:16 +0100
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.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/input/keyboard/matrix_keypad.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 90238201a9cc..16206a8a5f07 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -487,7 +487,7 @@ static int matrix_keypad_probe(struct platform_device *pdev)
return -EINVAL;
}
- keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
+ keypad = kzalloc(sizeof(*keypad), GFP_KERNEL);
input_dev = input_allocate_device();
if (!keypad || !input_dev) {
err = -ENOMEM;
--
2.16.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-01-27 12:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27 12:52 [PATCH 0/2] Input: matrix_keypad: Adjustments for two function implementations SF Markus Elfring
2018-01-27 12:52 ` SF Markus Elfring
2018-01-27 12:53 ` [PATCH 1/2] Input: matrix_keypad: Delete two error messages for a failed memory allocation in matrix_keypad_parse_dt() SF Markus Elfring
2018-01-27 12:53 ` [PATCH 1/2] Input: matrix_keypad: Delete two error messages for a failed memory allocation in matrix SF Markus Elfring
2018-01-27 12:54 ` [PATCH 2/2] Input: matrix_keypad: Improve a size determination in matrix_keypad_probe() SF Markus Elfring
2018-01-27 12:54 ` 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.