Re: [PATCH v1] gpio: merrifield: Convert to use acpi_dev_get_first_match()

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

 



On Thu, 2018-07-12 at 20:34 +0300, Andy Shevchenko wrote:
> acpi_dev_get_first_match_name() is deprecated because it leaks
> a reference count.
> 
> Convert the driver to use acpi_dev_get_first_match() instead.
> 

Linus, ignore this one, it has been send as a part of the series.
Sorry for noise.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpio/gpio-merrifield.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-merrifield.c b/drivers/gpio/gpio-
> merrifield.c
> index 97421bd4a60f..c618073b1d01 100644
> --- a/drivers/gpio/gpio-merrifield.c
> +++ b/drivers/gpio/gpio-merrifield.c
> @@ -381,10 +381,18 @@ static void mrfld_irq_init_hw(struct mrfld_gpio
> *priv)
>  	}
>  }
>  
> -static const char *mrfld_gpio_get_pinctrl_dev_name(void)
> +static const char *mrfld_gpio_get_pinctrl_dev_name(struct mrfld_gpio
> *priv)
>  {
> -	const char *dev_name =
> acpi_dev_get_first_match_name("INTC1002", NULL, -1);
> -	return dev_name ? dev_name : "pinctrl-merrifield";
> +	struct acpi_device *adev;
> +	const char *dev_name;
> +
> +	adev = acpi_dev_get_first_match("INTC1002", NULL, -1);
> +	if (!adev)
> +		return "pinctrl-merrifield";
> +
> +	dev_name = devm_kstrdup(priv->dev, acpi_dev_name(adev),
> GFP_KERNEL);
> +	put_device(&adev->dev);
> +	return dev_name;
>  }
>  
>  static int mrfld_gpio_probe(struct pci_dev *pdev, const struct
> pci_device_id *id)
> @@ -445,7 +453,7 @@ static int mrfld_gpio_probe(struct pci_dev *pdev,
> const struct pci_device_id *id
>  		return retval;
>  	}
>  
> -	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name();
> +	pinctrl_dev_name = mrfld_gpio_get_pinctrl_dev_name(priv);
>  	for (i = 0; i < ARRAY_SIZE(mrfld_gpio_ranges); i++) {
>  		range = &mrfld_gpio_ranges[i];
>  		retval = gpiochip_add_pin_range(&priv->chip,

-- 
Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Intel Finland Oy
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux