leds-88pm860x: use the goto label at data->port
PATCH 1/1 leds-88pm860x: use the goto label at data->port
at the goto lable out: we are doing free of the led data, and returning ret. the same we are doing at the data->port < 0 case, so use the goto end and assign ret to -EINVAL. this will make the common err path for the data->port and led_classdev_register functions.
--- drivers/leds/leds-88pm860x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-88pm860x.c +2 -2
@@ -220,8 +220,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->port = pdata->flags;if (data->port <0 ) {dev_err (&pdev->dev,"check device failed\n" ); -kfree (data); -return -EINVAL ; + ret = -EINVAL ; + goto out; } data->current_brightness =0 ;
Signature · 1 line
1.7.9.5
Quoted 5 lines · Devendra Naga
at the goto lable out: we are doing free of the led data, and returning ret. the same we are doing at the
data->port< 0 case, so use the goto end and assign ret to-EINVAL. this will make the common err path for thedata->portandled_classdev_registerfunctions.
This patch is not wrong, but it'd better we replace kzalloc/kfree to devm_kzalloc. So we don't care about kfree anymore.
Are interested in doing that?
Thanks,
-Bryan
Quoted 27 lines
Signed-off-by Devendra Naga <[email protected]>--- drivers/leds/leds-88pm860x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/leds/leds-88pm860x.c +2
-3@@ -220,8 +220,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->port = pdata->flags;if (data->port <0 ) {dev_err (&pdev->dev,"check device failed\n" ); -kfree (data); -return -EINVAL ; + ret = -EINVAL ; + goto out; } data->current_brightness =0 ; --1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com
Quoted 11 lines · Bryan Wu
Quoted 5 lines · Devendra Naga
at the goto lable out: we are doing free of the led data, and returning ret. the same we are doing at the
data->port< 0 case, so use the goto end and assign ret to-EINVAL. this will make the common err path for thedata->portandled_classdev_registerfunctions.This patch is not wrong, but it'd better we replace kzalloc/kfree to
devm_kzalloc. So we don't care about kfree anymore.
Are interested in doing that?
I have a doubt,
I think the dev pointer is chip->dev for using devm_* ?
please suggest me if i am wrong.
Quoted 26 lines
Thanks,
-BryanQuoted 23 lines
Signed-off-by Devendra Naga <[email protected]>--- drivers/leds/leds-88pm860x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/leds/leds-88pm860x.c +2
-3@@ -220,8 +220,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->port = pdata->flags;if (data->port <0 ) {dev_err (&pdev->dev,"check device failed\n" ); -kfree (data); -return -EINVAL ; + ret = -EINVAL ; + goto out; } data->current_brightness =0 ; --1.7.9.5
Quoted 12 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Bryan Wu <[email protected]>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.com
Thanks,
Devendra.
Quoted 8 lines · devendra.aaru
Quoted 7 lines · Bryan Wu
Quoted 5 lines · Devendra Naga
at the goto lable out: we are doing free of the led data, and returning ret. the same we are doing at the
data->port< 0 case, so use the goto end and assign ret to-EINVAL. this will make the common err path for thedata->portandled_classdev_registerfunctions.
Quoted 8 lines
Quoted 4 lines
This patch is not wrong, but it'd better we replace kzalloc/kfree to
devm_kzalloc. So we don't care about kfree anymore.
Are interested in doing that?I have a doubt,
I think the dev pointer is
chip->devfor using devm_* ?
data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_led), GFP_KERNEL);
You can simply just use pdev->dev, right?
-Bryan
Quoted 46 lines
please suggest me if i am wrong.
Quoted 26 lines
Thanks,
-BryanQuoted 23 lines
Signed-off-by Devendra Naga <[email protected]>--- drivers/leds/leds-88pm860x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/leds/leds-88pm860x.c +2
-3@@ -220,8 +220,8 @@ static int pm860x_led_probe(struct platform_device *pdev) data->port = pdata->flags;if (data->port <0 ) {dev_err (&pdev->dev,"check device failed\n" ); -kfree (data); -return -EINVAL ; + ret = -EINVAL ; + goto out; } data->current_brightness =0 ; --1.7.9.5
Quoted 12 lines
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
Bryan Wu <[email protected]>
Kernel Developer +86.186-168-78255 Mobile
Canonical Ltd. www.canonical.com
Ubuntu - Linux for human beings | www.ubuntu.comThanks,
Devendra.
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 4 lines
Bryan Wu <[email protected]> Kernel Developer +86.186-168-78255 Mobile Canonical Ltd. www.canonical.com Ubuntu - Linux for human beings | www.ubuntu.com