All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Toshi Kani <toshi.kani@hp.com>
Subject: Re: [PATCH] ACPI / container: Fix error code path in container_device_attach()
Date: Wed, 12 Feb 2014 14:22:59 +0900	[thread overview]
Message-ID: <52FB0533.3020908@jp.fujitsu.com> (raw)
In-Reply-To: <1575051.TZgsd5D5jn@vostro.rjw.lan>

(2014/02/12 9:05), Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> To avoid leaking memory on errors from device_register(), do a
> put_device() on the device object in question in the error code
> path of container_device_attach().
>
> Fixes: caa73ea158de (ACPI / hotplug / driver core: Handle containers in a special way)
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---

Looks good to me.

Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>

Thanks,
Yasuaki Ishimatsu

>
> 3.14 material.
>
> Thanks!
>
> ---
>   drivers/acpi/container.c |    5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> Index: linux-pm/drivers/acpi/container.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/container.c
> +++ linux-pm/drivers/acpi/container.c
> @@ -82,9 +82,10 @@ static int container_device_attach(struc
>   	ACPI_COMPANION_SET(dev, adev);
>   	dev->release = acpi_container_release;
>   	ret = device_register(dev);
> -	if (ret)
> +	if (ret) {
> +		put_device(dev);
>   		return ret;
> -
> +	}
>   	adev->driver_data = dev;
>   	return 1;
>   }
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



      reply	other threads:[~2014-02-12  5:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-12  0:05 [PATCH] ACPI / container: Fix error code path in container_device_attach() Rafael J. Wysocki
2014-02-12  5:22 ` Yasuaki Ishimatsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FB0533.3020908@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=toshi.kani@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.