Pinctrl-ADI GPIO2: Adjustments for two function implementations
Subsystems (3)
cover Pinctrl-ADI GPIO2: Adjustments for two function implementations
From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 12:52:42 +0100
Two update suggestions were taken into account
from static source code analysis.
Markus Elfring (2):
Delete an error message for a failed memory allocation in two functions Improve a size determination in two functions
drivers/pinctrl/pinctrl-adi2.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/2 pinctrl: adi2: Delete an error message for a failed memory allocation in two functions
From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 12:32:10 +0100
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/pinctrl/pinctrl-adi2.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/pinctrl/pinctrl-adi2.c +2 -6
@@ -830,10 +830,8 @@ static int adi_gpio_pint_probe(struct platform_device *pdev)struct gpio_pint *pint; pint =devm_kzalloc (dev,sizeof (struct gpio_pint ),GFP_KERNEL ); -if (!pint) { -dev_err (dev,"Memory alloc failed\n" ); +if (!pint)return -ENOMEM ; - } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); pint->base =devm_ioremap_resource (dev, res);
@@ -946,10 +944,8 @@ static int adi_gpio_probe(struct platform_device *pdev)return -EINVAL ; port =devm_kzalloc (dev,sizeof (struct gpio_port ),GFP_KERNEL ); -if (!port) { -dev_err (dev,"Memory alloc failed\n" ); +if (!port)return -ENOMEM ; - } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); port->base =devm_ioremap_resource (dev, res);
Signature · 1 line
2.15.1
Re: [PATCH 1/2] pinctrl: adi2: Delete an error message for a failed memory allocation in two functions
Quoted 8 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 12:32:10 +0100Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 2/2 pinctrl: adi2: Improve a size determination in two functions
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 12:38:53 +0100
Replace the specification of data structures by variable references as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention.
--- drivers/pinctrl/pinctrl-adi2.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-adi2.c +2 -3
@@ -827,9 +827,8 @@ static int adi_gpio_pint_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct resource *res; -struct gpio_pint *pint; +struct gpio_pint *pint =devm_kzalloc (dev,sizeof (*pint),GFP_KERNEL ); - pint =devm_kzalloc (dev,sizeof (struct gpio_pint ),GFP_KERNEL );if (!pint)return -ENOMEM ;
@@ -943,7 +942,7 @@ static int adi_gpio_probe(struct platform_device *pdev)if (!pdata)return -EINVAL ; - port =devm_kzalloc (dev,sizeof (struct gpio_port ),GFP_KERNEL ); + port =devm_kzalloc (dev,sizeof (*port),GFP_KERNEL );if (!port)return -ENOMEM ;
Signature · 1 line
2.15.1
Re: [PATCH 2/2] pinctrl: adi2: Improve a size determination in two functions
Quoted 8 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Wed, 20 Dec 2017 12:38:53 +0100Replace the specification of data structures by variable references 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 <[email protected]>
Patch applied.
Yours,
Linus Walleij