Re: sch_gpio: fix compilation warning "ignoring return value of gpiochip_remove"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Denis,

On Wed, Mar 03, 2010 at 11:33:29AM +0200, Denis Turischev wrote:
> Signed-off-by: Denis Turischev <denis@xxxxxxxxxxxxxx>
I modified this patch as you were leaking some resources releasing.

Cheers,
Samuel.

> ---
>  drivers/gpio/sch_gpio.c |   25 +++++++++++++++++++++----
>  1 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/sch_gpio.c b/drivers/gpio/sch_gpio.c
> index 761071a..a89c02d 100644
> --- a/drivers/gpio/sch_gpio.c
> +++ b/drivers/gpio/sch_gpio.c
> @@ -229,7 +229,12 @@ static int __devinit sch_gpio_probe(struct platform_device *pdev)
>  	return 0;
> 
>  err_sch_gpio_resume:
> -	gpiochip_remove(&sch_gpio_core);
> +	err = gpiochip_remove(&sch_gpio_core);
> +	if (err) {
> +		dev_err(&pdev->dev, "%s failed, %d\n",
> +				"gpiochip_remove()", err);
> +		return err;
> +	}
> 
>  err_sch_gpio_core:
>  	release_region(res->start, resource_size(res));
> @@ -240,11 +245,23 @@ err_sch_gpio_core:
> 
>  static int __devexit sch_gpio_remove(struct platform_device *pdev)
>  {
> +	int err_c, err_r;
>  	struct resource *res;
>  	if (gpio_ba) {
> -		gpiochip_remove(&sch_gpio_core);
> -		gpiochip_remove(&sch_gpio_resume);
> -
> +		err_c = gpiochip_remove(&sch_gpio_core);
> +		
> +		err_r = gpiochip_remove(&sch_gpio_resume);
> +
> +		if (err_c) {
> +			dev_err(&pdev->dev, "%s failed, %d\n",
> +					"gpiochip_remove()", err_c);
> +			return err_c;
> +		}
> +		if (err_r) {
> +			dev_err(&pdev->dev, "%s failed, %d\n",
> +					"gpiochip_remove()", err_r);
> +			return err_r;
> +		}
>  		res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> 
>  		release_region(res->start, resource_size(res));
> -- 
> 1.6.3.3
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux