Message ID | 20190328171729.44002-3-andriy.shevchenko@linux.intel.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 0cf064db948aca1e760fc513594536f761dee1cd |
Headers | show |
Series | ACPI / utils: Replace leaky function | expand |
Hi Andy, On 19. 3. 29. 오전 2:17, Andy Shevchenko wrote: > acpi_dev_get_first_match_name() is deprecated and going to be removed > because it leaks a reference. > > Convert the driver to use acpi_dev_get_first_match_dev() instead. > > Cc: Chanwoo Choi <cw00.choi@samsung.com> > Cc: MyungJoo Ham <myungjoo.ham@samsung.com> > Cc: Chen-Yu Tsai <wens@csie.org> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > drivers/extcon/extcon-axp288.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c > index a983708b77a6..50f9402fb325 100644 > --- a/drivers/extcon/extcon-axp288.c > +++ b/drivers/extcon/extcon-axp288.c > @@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) > struct axp288_extcon_info *info; > struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); > struct device *dev = &pdev->dev; > - const char *name; > + struct acpi_device *adev; > int ret, i, pirq; > > info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); > @@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev) > if (ret) > return ret; > > - name = acpi_dev_get_first_match_name("INT3496", NULL, -1); > - if (name) { > - info->id_extcon = extcon_get_extcon_dev(name); > + adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1); > + if (adev) { > + info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev)); > + put_device(&adev->dev); > if (!info->id_extcon) > return -EPROBE_DEFER; > > Applied it. Thanks.
On Friday, March 29, 2019 1:53:09 AM CET Chanwoo Choi wrote: > Hi Andy, > > On 19. 3. 29. 오전 2:17, Andy Shevchenko wrote: > > acpi_dev_get_first_match_name() is deprecated and going to be removed > > because it leaks a reference. > > > > Convert the driver to use acpi_dev_get_first_match_dev() instead. > > > > Cc: Chanwoo Choi <cw00.choi@samsung.com> > > Cc: MyungJoo Ham <myungjoo.ham@samsung.com> > > Cc: Chen-Yu Tsai <wens@csie.org> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > --- > > drivers/extcon/extcon-axp288.c | 9 +++++---- > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c > > index a983708b77a6..50f9402fb325 100644 > > --- a/drivers/extcon/extcon-axp288.c > > +++ b/drivers/extcon/extcon-axp288.c > > @@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) > > struct axp288_extcon_info *info; > > struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); > > struct device *dev = &pdev->dev; > > - const char *name; > > + struct acpi_device *adev; > > int ret, i, pirq; > > > > info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); > > @@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev) > > if (ret) > > return ret; > > > > - name = acpi_dev_get_first_match_name("INT3496", NULL, -1); > > - if (name) { > > - info->id_extcon = extcon_get_extcon_dev(name); > > + adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1); > > + if (adev) { > > + info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev)); > > + put_device(&adev->dev); > > if (!info->id_extcon) > > return -EPROBE_DEFER; > > > > > > Applied it. Thanks. > > But it won't build without the first patch I suppose? ACK, please?
Hi Rafael, On 19. 3. 30. 오전 7:58, Rafael J. Wysocki wrote: > On Friday, March 29, 2019 1:53:09 AM CET Chanwoo Choi wrote: >> Hi Andy, >> >> On 19. 3. 29. 오전 2:17, Andy Shevchenko wrote: >>> acpi_dev_get_first_match_name() is deprecated and going to be removed >>> because it leaks a reference. >>> >>> Convert the driver to use acpi_dev_get_first_match_dev() instead. >>> >>> Cc: Chanwoo Choi <cw00.choi@samsung.com> >>> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> >>> Cc: Chen-Yu Tsai <wens@csie.org> >>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> >>> --- >>> drivers/extcon/extcon-axp288.c | 9 +++++---- >>> 1 file changed, 5 insertions(+), 4 deletions(-) >>> >>> diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c >>> index a983708b77a6..50f9402fb325 100644 >>> --- a/drivers/extcon/extcon-axp288.c >>> +++ b/drivers/extcon/extcon-axp288.c >>> @@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) >>> struct axp288_extcon_info *info; >>> struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); >>> struct device *dev = &pdev->dev; >>> - const char *name; >>> + struct acpi_device *adev; >>> int ret, i, pirq; >>> >>> info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); >>> @@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev) >>> if (ret) >>> return ret; >>> >>> - name = acpi_dev_get_first_match_name("INT3496", NULL, -1); >>> - if (name) { >>> - info->id_extcon = extcon_get_extcon_dev(name); >>> + adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1); >>> + if (adev) { >>> + info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev)); >>> + put_device(&adev->dev); >>> if (!info->id_extcon) >>> return -EPROBE_DEFER; >>> >>> >> >> Applied it. Thanks. >> >> > > But it won't build without the first patch I suppose? > > ACK, please? It is my fault. I'll drop it from extcon.git. Acked-by: Chanwoo Choi <cw00.choi@samsung.com> > > > >
diff --git a/drivers/extcon/extcon-axp288.c b/drivers/extcon/extcon-axp288.c index a983708b77a6..50f9402fb325 100644 --- a/drivers/extcon/extcon-axp288.c +++ b/drivers/extcon/extcon-axp288.c @@ -333,7 +333,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) struct axp288_extcon_info *info; struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); struct device *dev = &pdev->dev; - const char *name; + struct acpi_device *adev; int ret, i, pirq; info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); @@ -357,9 +357,10 @@ static int axp288_extcon_probe(struct platform_device *pdev) if (ret) return ret; - name = acpi_dev_get_first_match_name("INT3496", NULL, -1); - if (name) { - info->id_extcon = extcon_get_extcon_dev(name); + adev = acpi_dev_get_first_match_dev("INT3496", NULL, -1); + if (adev) { + info->id_extcon = extcon_get_extcon_dev(acpi_dev_name(adev)); + put_device(&adev->dev); if (!info->id_extcon) return -EPROBE_DEFER;
acpi_dev_get_first_match_name() is deprecated and going to be removed because it leaks a reference. Convert the driver to use acpi_dev_get_first_match_dev() instead. Cc: Chanwoo Choi <cw00.choi@samsung.com> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/extcon/extcon-axp288.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)