staging: mt7621-pinctrl: Remove space after cast
Subsystems (2)
PATCH 1/1 staging: mt7621-pinctrl: Remove space after cast
This patch removes space after a cast as it
is not needed.
Issue found by checkpatch.
--- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +1 -1
@@ -363,7 +363,7 @@ static int rt2880_pinmux_probe(struct platform_device *pdev) } range =devm_kzalloc (p->dev,sizeof (*range) +4 ,GFP_KERNEL ); - range->name = name = (char *) &range[1 ]; + range->name = name = (char *)&range[1 ];sprintf (name,"pio" ); range->npins =__be32_to_cpu (*ngpio); range->base =__be32_to_cpu (*gpiobase);
Signature · 1 line
2.17.1
Quoted 14 lines · Nishad Kamdar
This patch removes space after a cast as it
is not needed.
Issue found by checkpatch.Signed-off-by Nishad Kamdar <[email protected]>--- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +0
-0
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c static int rt2880_pinmux_probe(struct platform_device *pdev) · line 367
Quoted 6 lines
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +1
-1@@ -363,7 +363,7 @@ static int rt2880_pinmux_probe(struct platform_device *pdev) } range =devm_kzalloc (p->dev,sizeof (*range) +4 ,GFP_KERNEL ); - range->name = name = (char *) &range[1 ]; + range->name = name = (char *)&range[1 ];sprintf (name,"pio" );
I find this code unsightly and fragile.
It doesn't test the return of devm_kzalloc for failure.
This might as well be
--- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +4 -4
@@ -350,7 +350,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)for_each_compatible_node (np,NULL ,"ralink,rt2880-gpio" ) {const __be32 *ngpio, *gpiobase;struct pinctrl_gpio_range *range; -char *name;if (!of_device_is_available (np))continue ;
@@ -362,9 +361,10 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)return -EINVAL ; } - range =devm_kzalloc (p->dev,sizeof (*range) +4 ,GFP_KERNEL ); - range->name = name = (char *) &range[1 ]; -sprintf (name,"pio" ); + range =devm_kzalloc (p->dev,sizeof (*range),GFP_KERNEL ); +if (!range) +return -ENOMEM ; + range->name ="pio" ; range->npins =__be32_to_cpu (*ngpio); range->base =__be32_to_cpu (*gpiobase); range->pin_base = range->base;
Quoted 49 lines · Joe Perches
Quoted 14 lines · Nishad Kamdar
This patch removes space after a cast as it
is not needed.
Issue found by checkpatch.Signed-off-by Nishad Kamdar <[email protected]>--- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +0
-0drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c static int rt2880_pinmux_probe(struct platform_device *pdev) · line 367
Quoted 6 lines
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +1
-1@@ -363,7 +363,7 @@ static int rt2880_pinmux_probe(struct platform_device *pdev) } range =devm_kzalloc (p->dev,sizeof (*range) +4 ,GFP_KERNEL ); - range->name = name = (char *) &range[1 ]; + range->name = name = (char *)&range[1 ];sprintf (name,"pio" );I find this code unsightly and fragile.
It doesn't test the return ofdevm_kzallocfor failure.This might as well be
--- drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +0
-1@@ -350,7 +350,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)for_each_compatible_node (np,NULL ,"ralink,rt2880-gpio" ) {const __be32 *ngpio, *gpiobase;struct pinctrl_gpio_range *range; -char *name;if (!of_device_is_available (np))continue ;@@ -362,9 +361,10 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)return -EINVAL ; }
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c static int rt2880_pinmux_probe(struct platform_device *pdev) · line 370
Quoted 10 lines
drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c +4
-3- range =devm_kzalloc (p->dev,sizeof (*range) +4 ,GFP_KERNEL ); - range->name = name = (char *) &range[1 ]; -sprintf (name,"pio" ); + range =devm_kzalloc (p->dev,sizeof (*range),GFP_KERNEL ); +if (!range) +return -ENOMEM ; + range->name ="pio" ; range->npins =__be32_to_cpu (*ngpio); range->base =__be32_to_cpu (*gpiobase); range->pin_base = range->base;
Ok, I'll include it as a new patch as I think this one has already been accepted.
Thanks for the review.
Regards,
Nishad