* [PATCH 0/6] PNP: Adjustments for four function implementations
@ 2017-05-15 19:10 SF Markus Elfring
2017-05-15 19:12 ` [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc() SF Markus Elfring
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:10 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 21:03:21 +0200
A few update suggestions were taken into account
from static source code analysis.
Markus Elfring (6):
Delete an error message for a failed memory allocation in pnp_alloc()
Improve a size determination in pnp_alloc_dev()
Improve a size determination in pnp_clone_dependent_set()
Delete an error message for a failed memory allocation in pnp_clone_dependent_set()
Improve a size determination in quirk_awe32_add_ports()
Delete an error message for a failed memory allocation in quirk_awe32_add_ports()
drivers/pnp/core.c | 6 ++----
drivers/pnp/quirks.c | 15 ++++-----------
2 files changed, 6 insertions(+), 15 deletions(-)
--
2.13.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
@ 2017-05-15 19:12 ` SF Markus Elfring
2017-05-15 19:14 ` [PATCH 2/6] PNP: Improve a size determination in pnp_alloc_dev() SF Markus Elfring
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:12 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 19:35:29 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pnp/core.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index b54620e53830..27945a2d9c4e 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -35,10 +35,8 @@ void *pnp_alloc(long size)
void *result;
result = kzalloc(size, GFP_KERNEL);
- if (!result) {
- printk(KERN_ERR "pnp: Out of Memory\n");
+ if (!result)
return NULL;
- }
return result;
}
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] PNP: Improve a size determination in pnp_alloc_dev()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
2017-05-15 19:12 ` [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc() SF Markus Elfring
@ 2017-05-15 19:14 ` SF Markus Elfring
2017-05-15 19:16 ` [PATCH 3/6] PNP: Improve a size determination in pnp_clone_dependent_set() SF Markus Elfring
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:14 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 19:45:23 +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/pnp/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 27945a2d9c4e..6ccec10aed11 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -141,7 +141,7 @@ struct pnp_dev *pnp_alloc_dev(struct pnp_protocol *protocol, int id,
struct pnp_dev *dev;
struct pnp_id *dev_id;
- dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev)
return NULL;
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] PNP: Improve a size determination in pnp_clone_dependent_set()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
2017-05-15 19:12 ` [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc() SF Markus Elfring
2017-05-15 19:14 ` [PATCH 2/6] PNP: Improve a size determination in pnp_alloc_dev() SF Markus Elfring
@ 2017-05-15 19:16 ` SF Markus Elfring
2017-05-15 19:18 ` [PATCH 4/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:16 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 19:52:26 +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/pnp/quirks.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index d28e3ab9479c..215a50723243 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -155,6 +155,5 @@ static struct pnp_option *pnp_clone_dependent_set(struct pnp_dev *dev,
list_for_each_entry(option, &dev->options, list) {
if (pnp_option_is_dependent(option) &&
pnp_option_set(option) == set) {
- new_option = kmalloc(sizeof(struct pnp_option),
- GFP_KERNEL);
+ new_option = kmalloc(sizeof(*new_option), GFP_KERNEL);
if (!new_option) {
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] PNP: Delete an error message for a failed memory allocation in pnp_clone_dependent_set()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
` (2 preceding siblings ...)
2017-05-15 19:16 ` [PATCH 3/6] PNP: Improve a size determination in pnp_clone_dependent_set() SF Markus Elfring
@ 2017-05-15 19:18 ` SF Markus Elfring
2017-05-15 19:20 ` [PATCH 5/6] PNP: Improve a size determination in quirk_awe32_add_ports() SF Markus Elfring
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:18 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 20:00:38 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pnp/quirks.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 215a50723243..34e2d4563bbd 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -159,8 +159,5 @@ static struct pnp_option *pnp_clone_dependent_set(struct pnp_dev *dev,
- if (!new_option) {
- dev_err(&dev->dev, "couldn't clone dependent "
- "set %d\n", set);
+ if (!new_option)
return NULL;
- }
*new_option = *option;
new_option->flags = flags;
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] PNP: Improve a size determination in quirk_awe32_add_ports()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
` (3 preceding siblings ...)
2017-05-15 19:18 ` [PATCH 4/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-05-15 19:20 ` SF Markus Elfring
2017-05-15 19:22 ` [PATCH 6/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:20 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 20:32:12 +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/pnp/quirks.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 34e2d4563bbd..f9be5f3fb7ea 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -29,5 +29,5 @@ static void quirk_awe32_add_ports(struct pnp_dev *dev,
{
struct pnp_option *new_option;
- new_option = kmalloc(sizeof(struct pnp_option), GFP_KERNEL);
+ new_option = kmalloc(sizeof(*new_option), GFP_KERNEL);
if (!new_option) {
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] PNP: Delete an error message for a failed memory allocation in quirk_awe32_add_ports()
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
` (4 preceding siblings ...)
2017-05-15 19:20 ` [PATCH 5/6] PNP: Improve a size determination in quirk_awe32_add_ports() SF Markus Elfring
@ 2017-05-15 19:22 ` SF Markus Elfring
2017-05-27 19:08 ` [PATCH 0/6] PNP: Adjustments for four function implementations Andy Shevchenko
2017-12-18 18:21 ` SF Markus Elfring
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-05-15 19:22 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML, Wolfram Sang
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 20:36:35 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/pnp/quirks.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index f9be5f3fb7ea..ae7fbf105e0a 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -33,8 +33,5 @@ static void quirk_awe32_add_ports(struct pnp_dev *dev,
- if (!new_option) {
- dev_err(&dev->dev, "couldn't add ioport region to option set "
- "%d\n", pnp_option_set(option));
+ if (!new_option)
return;
- }
*new_option = *option;
new_option->u.port.min += offset;
--
2.13.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 0/6] PNP: Adjustments for four function implementations
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
` (5 preceding siblings ...)
2017-05-15 19:22 ` [PATCH 6/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
@ 2017-05-27 19:08 ` Andy Shevchenko
2017-12-18 18:21 ` SF Markus Elfring
7 siblings, 0 replies; 9+ messages in thread
From: Andy Shevchenko @ 2017-05-27 19:08 UTC (permalink / raw)
To: SF Markus Elfring; +Cc: Rafael J. Wysocki, kernel-janitors, LKML
On Mon, May 15, 2017 at 10:10 PM, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 May 2017 21:03:21 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
You need to fold these 6 in to two:
PNP: Improve a size determination
PNP: Delete an error message for a failed memory allocation
And effectively after I'm not sure the first one even needed for now.
>
> Markus Elfring (6):
> Delete an error message for a failed memory allocation in pnp_alloc()
> Improve a size determination in pnp_alloc_dev()
> Improve a size determination in pnp_clone_dependent_set()
> Delete an error message for a failed memory allocation in pnp_clone_dependent_set()
> Improve a size determination in quirk_awe32_add_ports()
> Delete an error message for a failed memory allocation in quirk_awe32_add_ports()
>
> drivers/pnp/core.c | 6 ++----
> drivers/pnp/quirks.c | 15 ++++-----------
> 2 files changed, 6 insertions(+), 15 deletions(-)
>
> --
> 2.13.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/6] PNP: Adjustments for four function implementations
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
` (6 preceding siblings ...)
2017-05-27 19:08 ` [PATCH 0/6] PNP: Adjustments for four function implementations Andy Shevchenko
@ 2017-12-18 18:21 ` SF Markus Elfring
7 siblings, 0 replies; 9+ messages in thread
From: SF Markus Elfring @ 2017-12-18 18:21 UTC (permalink / raw)
To: Rafael J. Wysocki, kernel-janitors; +Cc: LKML
> Date: Mon, 15 May 2017 21:03:21 +0200
>
> A few update suggestions were taken into account
> from static source code analysis.
>
> Markus Elfring (6):
> Delete an error message for a failed memory allocation in pnp_alloc()
> Improve a size determination in pnp_alloc_dev()
> Improve a size determination in pnp_clone_dependent_set()
> Delete an error message for a failed memory allocation in pnp_clone_dependent_set()
> Improve a size determination in quirk_awe32_add_ports()
> Delete an error message for a failed memory allocation in quirk_awe32_add_ports()
>
> drivers/pnp/core.c | 6 ++----
> drivers/pnp/quirks.c | 15 ++++-----------
> 2 files changed, 6 insertions(+), 15 deletions(-)
How are the chances that such change possibilities will be integrated
in this software module?
Regards,
Markus
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-12-18 18:21 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-15 19:10 [PATCH 0/6] PNP: Adjustments for four function implementations SF Markus Elfring
2017-05-15 19:12 ` [PATCH 1/6] PNP: Delete an error message for a failed memory allocation in pnp_alloc() SF Markus Elfring
2017-05-15 19:14 ` [PATCH 2/6] PNP: Improve a size determination in pnp_alloc_dev() SF Markus Elfring
2017-05-15 19:16 ` [PATCH 3/6] PNP: Improve a size determination in pnp_clone_dependent_set() SF Markus Elfring
2017-05-15 19:18 ` [PATCH 4/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-15 19:20 ` [PATCH 5/6] PNP: Improve a size determination in quirk_awe32_add_ports() SF Markus Elfring
2017-05-15 19:22 ` [PATCH 6/6] PNP: Delete an error message for a failed memory allocation " SF Markus Elfring
2017-05-27 19:08 ` [PATCH 0/6] PNP: Adjustments for four function implementations Andy Shevchenko
2017-12-18 18:21 ` 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).