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] [thread-next>] [day] [month] [year] [list]
Message-ID: <53246F79.1020000@kernel.org>
Date:	Sat, 15 Mar 2014 15:19:21 +0000
From:	Jonathan Cameron <jic23@...nel.org>
To:	Sebastian Reichel <sre@...ian.org>,
	Sebastian Reichel <sre@...g0.de>,
	Marek Belisko <marek@...delico.com>
CC:	Lee Jones <lee.jones@...aro.org>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Grant Likely <grant.likely@...aro.org>,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	linux-iio@...r.kernel.org
Subject: Re: [PATCHv2 1/9] mfd: twl4030-madc: Use managed resources

On 04/03/14 22:05, Sebastian Reichel wrote:
> Update twl4030-madc driver to use managed resources.
>
> Signed-off-by: Sebastian Reichel <sre@...ian.org>
> Acked-by: Lee Jones <lee.jones@...aro.org>
Acked-by: Jonathan Cameron <jic23@...nel.org>
> ---
>   drivers/mfd/twl4030-madc.c | 15 ++++++---------
>   1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c
> index 4c583e4..5458561 100644
> --- a/drivers/mfd/twl4030-madc.c
> +++ b/drivers/mfd/twl4030-madc.c
> @@ -702,14 +702,14 @@ static int twl4030_madc_probe(struct platform_device *pdev)
>   {
>   	struct twl4030_madc_data *madc;
>   	struct twl4030_madc_platform_data *pdata = dev_get_platdata(&pdev->dev);
> -	int ret;
> +	int irq, ret;
>   	u8 regval;
>
>   	if (!pdata) {
>   		dev_err(&pdev->dev, "platform_data not available\n");
>   		return -EINVAL;
>   	}
> -	madc = kzalloc(sizeof(*madc), GFP_KERNEL);
> +	madc = devm_kzalloc(&pdev->dev, sizeof(*madc), GFP_KERNEL);
>   	if (!madc)
>   		return -ENOMEM;
>
> @@ -726,7 +726,7 @@ static int twl4030_madc_probe(struct platform_device *pdev)
>   	    TWL4030_MADC_ISR1 : TWL4030_MADC_ISR2;
>   	ret = twl4030_madc_set_power(madc, 1);
>   	if (ret < 0)
> -		goto err_power;
> +		return ret;
>   	ret = twl4030_madc_set_current_generator(madc, 0, 1);
>   	if (ret < 0)
>   		goto err_current_generator;
> @@ -770,7 +770,9 @@ static int twl4030_madc_probe(struct platform_device *pdev)
>
>   	platform_set_drvdata(pdev, madc);
>   	mutex_init(&madc->lock);
> -	ret = request_threaded_irq(platform_get_irq(pdev, 0), NULL,
> +
> +	irq = platform_get_irq(pdev, 0);
> +	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
>   				   twl4030_madc_threaded_irq_handler,
>   				   IRQF_TRIGGER_RISING, "twl4030_madc", madc);
>   	if (ret) {
> @@ -783,9 +785,6 @@ err_i2c:
>   	twl4030_madc_set_current_generator(madc, 0, 0);
>   err_current_generator:
>   	twl4030_madc_set_power(madc, 0);
> -err_power:
> -	kfree(madc);
> -
>   	return ret;
>   }
>
> @@ -793,10 +792,8 @@ static int twl4030_madc_remove(struct platform_device *pdev)
>   {
>   	struct twl4030_madc_data *madc = platform_get_drvdata(pdev);
>
> -	free_irq(platform_get_irq(pdev, 0), madc);
>   	twl4030_madc_set_current_generator(madc, 0, 0);
>   	twl4030_madc_set_power(madc, 0);
> -	kfree(madc);
>
>   	return 0;
>   }
>

--
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