PNP: Adjustments for four function implementations
Subsystems (2)
cover PNP: Adjustments for four function implementations
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.13.0
PATCH 1/6 PNP: Delete an error message for a failed memory allocation in pnp_alloc()
From: Markus Elfring <[email protected]>
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.
--- drivers/pnp/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pnp/core.c +1 -3
@@ -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; }
Signature · 1 line
2.13.0
PATCH 2/6 PNP: Improve a size determination in pnp_alloc_dev()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pnp/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pnp/core.c +1 -1
@@ -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 ;
Signature · 1 line
2.13.0
PATCH 3/6 PNP: Improve a size determination in pnp_clone_dependent_set()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pnp/quirks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pnp/quirks.c +1 -2
@@ -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) {
Signature · 1 line
2.13.0
PATCH 4/6 PNP: Delete an error message for a failed memory allocation in pnp_clone_dependent_set()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pnp/quirks.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/quirks.c +1 -4
@@ -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;
Signature · 1 line
2.13.0
PATCH 5/6 PNP: Improve a size determination in quirk_awe32_add_ports()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pnp/quirks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pnp/quirks.c +1 -1
@@ -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) {
Signature · 1 line
2.13.0
PATCH 6/6 PNP: Delete an error message for a failed memory allocation in quirk_awe32_add_ports()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pnp/quirks.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/quirks.c +1 -4
@@ -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;
Signature · 1 line
2.13.0
Quoted 5 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Mon, 15 May 2017 21:03:21 +0200A 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.
Quoted 16 lines
Markus Elfring (6):
Delete an error message for a failed memory allocation inpnp_alloc()Improve a size determination inpnp_alloc_dev()
Improve a size determination inpnp_clone_dependent_set()
Delete an error message for a failed memory allocation inpnp_clone_dependent_set()Improve a size determination inquirk_awe32_add_ports()
Delete an error message for a failed memory allocation inquirk_awe32_add_ports()drivers/pnp/core.c | 6 ++---- drivers/pnp/quirks.c | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-)--
2.13.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 13 lines
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 inpnp_alloc()Improve a size determination inpnp_alloc_dev()
Improve a size determination inpnp_clone_dependent_set()
Delete an error message for a failed memory allocation inpnp_clone_dependent_set()Improve a size determination inquirk_awe32_add_ports()
Delete an error message for a failed memory allocation inquirk_awe32_add_ports()
Quoted 3 lines
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