lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJKOXPddqv+rBngO0NGrVap1ibGjrMp3a9ihcQ2G7yEgEYt71g@mail.gmail.com>
Date:	Thu, 13 Aug 2015 08:49:23 +0900
From:	Krzysztof Kozlowski <k.kozlowski@...sung.com>
To:	Vaishali Thakkar <vthakkar1994@...il.com>
Cc:	Sebastian Reichel <sre@...nel.org>,
	Dmitry Eremin-Solenikov <dbaryshkov@...il.com>,
	David Woodhouse <dwmw2@...radead.org>,
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] power_supply: max8998: Use devm_power_supply_register

2015-08-13 0:06 GMT+09:00 Vaishali Thakkar <vthakkar1994@...il.com>:
>
> Use managed resource function devm_power_supply_register
> instead of power_supply_register.

Please describe: Why? What is the reason for such change?
I can't find any significant simplifications, just one remove() disappears.

Best regards,
Krzysztof

> To be compatible with the
> change, replace various gotos by direct returns and remove
> unneeded label err.
>
> Also, remove max8998_battery_remove as it is now redundant.
>
> Signed-off-by: Vaishali Thakkar <vthakkar1994@...il.com>
> ---
>  drivers/power/max8998_charger.c | 28 +++++++---------------------
>  1 file changed, 7 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/power/max8998_charger.c b/drivers/power/max8998_charger.c
> index 47448d4..6014df5 100644
> --- a/drivers/power/max8998_charger.c
> +++ b/drivers/power/max8998_charger.c
> @@ -117,8 +117,7 @@ static int max8998_battery_probe(struct platform_device *pdev)
>                         "EOC value not set: leave it unchanged.\n");
>         } else {
>                 dev_err(max8998->dev, "Invalid EOC value\n");
> -               ret = -EINVAL;
> -               goto err;
> +               return -EINVAL;
>         }
>
>         /* Setup Charge Restart Level */
> @@ -141,8 +140,7 @@ static int max8998_battery_probe(struct platform_device *pdev)
>                 break;
>         default:
>                 dev_err(max8998->dev, "Invalid Restart Level\n");
> -               ret = -EINVAL;
> -               goto err;
> +               return -EINVAL;
>         }
>
>         /* Setup Charge Full Timeout */
> @@ -165,34 +163,22 @@ static int max8998_battery_probe(struct platform_device *pdev)
>                 break;
>         default:
>                 dev_err(max8998->dev, "Invalid Full Timeout value\n");
> -               ret = -EINVAL;
> -               goto err;
> +               return -EINVAL;
>         }
>
>         psy_cfg.drv_data = max8998;
>
> -       max8998->battery = power_supply_register(max8998->dev,
> -                                                &max8998_battery_desc,
> -                                                &psy_cfg);
> +       max8998->battery = devm_power_supply_register(max8998->dev,
> +                                                     &max8998_battery_desc,
> +                                                     &psy_cfg);
>         if (IS_ERR(max8998->battery)) {
>                 ret = PTR_ERR(max8998->battery);
>                 dev_err(max8998->dev, "failed: power supply register: %d\n",
>                         ret);
> -               goto err;
> +               return ret;
>         }
>
>         return 0;
> -err:
> -       return ret;
> -}
> -
> -static int max8998_battery_remove(struct platform_device *pdev)
> -{
> -       struct max8998_battery_data *max8998 = platform_get_drvdata(pdev);
> -
> -       power_supply_unregister(max8998->battery);
> -
> -       return 0;
>  }
>
>  static const struct platform_device_id max8998_battery_id[] = {
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ