Pinctrl-Rockchip: Adjustments for six functions
Subsystems (4)
cover Pinctrl-Rockchip: Adjustments for six functions
From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:33:44 +0100
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete error messages for a failed memory allocation in two functions Improve a size determination in rockchip_pinctrl_probe() Fix a typo in four comment lines
drivers/pinctrl/pinctrl-rockchip.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-)
Signature · 1 line
2.15.1
PATCH 1/3 pinctrl: rockchip: Delete error messages for a failed memory allocation in two functions
From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:02:47 +0100
Omit extra messages for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
--- drivers/pinctrl/pinctrl-rockchip.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +4 -9
@@ -2400,18 +2400,14 @@ static int rockchip_pinctrl_parse_dt(struct platform_device *pdev, info->functions =devm_kzalloc (dev, info->nfunctions *sizeof (struct rockchip_pmx_func ),GFP_KERNEL ); -if (!info->functions) { -dev_err (dev,"failed to allocate memory for function list\n" ); +if (!info->functions)return -EINVAL ; - } info->groups =devm_kzalloc (dev, info->ngroups *sizeof (struct rockchip_pin_group ),GFP_KERNEL ); -if (!info->groups) { -dev_err (dev,"failed allocate memory for ping group list\n" ); +if (!info->groups)return -EINVAL ; - } i =0 ;
@@ -2447,10 +2443,9 @@ static int rockchip_pinctrl_register(struct platform_device *pdev, pindesc =devm_kzalloc (&pdev->dev,sizeof (*pindesc) * info->ctrl->nr_pins,GFP_KERNEL ); -if (!pindesc) { -dev_err (&pdev->dev,"mem alloc for pin descriptors failed\n" ); +if (!pindesc)return -ENOMEM ; - } + ctrldesc->pins = pindesc; ctrldesc->npins = info->ctrl->nr_pins;
Signature · 1 line
2.15.1
Re: [PATCH 1/3] pinctrl: rockchip: Delete error messages for a failed memory allocation in two functions
Quoted 8 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:02:47 +0100Omit extra messages 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/3 pinctrl: rockchip: Improve a size determination in rockchip_pinctrl_probe()
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:07:30 +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.
--- drivers/pinctrl/pinctrl-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/pinctrl-rockchip.c +1 -1
@@ -3158,7 +3158,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev)return -ENODEV ; } - info =devm_kzalloc (dev,sizeof (struct rockchip_pinctrl ),GFP_KERNEL ); + info =devm_kzalloc (dev,sizeof (*info),GFP_KERNEL );if (!info)return -ENOMEM ;
Signature · 1 line
2.15.1
Re: [PATCH 2/3] pinctrl: rockchip: Improve a size determination in rockchip_pinctrl_probe()
Quoted 10 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:07:30 +0100Replace 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 <[email protected]>
Patch applied.
Yours,
Linus Walleij
PATCH 3/3 pinctrl: rockchip: Fix a typo in four comment lines
In reply to SF Markus ElfringFrom: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:22:54 +0100
Adjust words in these descriptions.
--- drivers/pinctrl/pinctrl-rockchip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pinctrl/pinctrl-rockchip.c +4 -4
@@ -136,7 +136,7 @@ struct rockchip_drv {* @iomux: array describing the 4 iomux sources of the bank * @drv: array describing the 4 drive strength sources of the bank * @pull_type: array describing the 4 pull type sources of the bank -* @valid: are all necessary informations present +* @valid: is all necessary information present * @of_node: dt node of this bank * @drvdata: common pinctrl basedata * @domain: irqdomain of the gpio bank
@@ -1988,7 +1988,7 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, info->functions[selector].name, info->groups[group].name);/* -* for each pin in the pin group selected, program the correspoding pin +* for each pin in the pin group selected, program the corresponding * pin function number in the config register. */ for (cnt =0 ; cnt < info->groups[group].npins; cnt++) {
@@ -2527,7 +2527,7 @@ static int rockchip_gpio_get(struct gpio_chip *gc, unsigned offset)/* * gpiolib gpio_direction_input callback function. The setting of the pin -* mux function as 'gpio input' will be handled by the pinctrl susbsystem +* mux function as 'gpio input' will be handled by the pinctrl subsystem * interface. */ static int rockchip_gpio_direction_input (struct gpio_chip *gc,unsigned offset)
@@ -2537,7 +2537,7 @@ static int rockchip_gpio_direction_input(struct gpio_chip *gc, unsigned offset)/* * gpiolib gpio_direction_output callback function. The setting of the pin -* mux function as 'gpio output' will be handled by the pinctrl susbsystem +* mux function as 'gpio output' will be handled by the pinctrl subsystem * interface. */ static int rockchip_gpio_direction_output(struct gpio_chip *gc,
Signature · 1 line
2.15.1
Re: [PATCH 3/3] pinctrl: rockchip: Fix a typo in four comment lines
Quoted 6 lines · SF Markus Elfring
From: Markus Elfring <[email protected]>
Date: Sat, 23 Dec 2017 22:22:54 +0100Adjust words in these descriptions.
Signed-off-by Markus Elfring <[email protected]>
Patch applied.
Yours,
Linus Walleij