public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rajiv Andrade <srajiv@linux.vnet.ibm.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: debora@linux.vnet.ibm.com, tpmdd-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tpm: fix memleak when register hardware fails
Date: Wed, 23 May 2012 12:31:24 -0300	[thread overview]
Message-ID: <4FBD02CC.4080600@linux.vnet.ibm.com> (raw)
In-Reply-To: <1337156668-19462-1-git-send-email-gaowanlong@cn.fujitsu.com>

On 16/05/12 05:24, Wanlong Gao wrote:
> Signed-off-by: Wanlong Gao<gaowanlong@cn.fujitsu.com>
> ---
>   drivers/char/tpm/tpm.c |    9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
> index ad7c732..c967919 100644
> --- a/drivers/char/tpm/tpm.c
> +++ b/drivers/char/tpm/tpm.c
> @@ -1405,15 +1405,12 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
>   			"unable to misc_register %s, minor %d\n",
>   			chip->vendor.miscdev.name,
>   			chip->vendor.miscdev.minor);
> -		put_device(chip->dev);
> -		return NULL;
> +		goto put_device;
>   	}
>
>   	if (sysfs_create_group(&dev->kobj, chip->vendor.attr_group)) {
>   		misc_deregister(&chip->vendor.miscdev);
> -		put_device(chip->dev);
> -
> -		return NULL;
> +		goto put_device;
>   	}
>
>   	chip->bios_dir = tpm_bios_log_setup(devname);
> @@ -1425,6 +1422,8 @@ struct tpm_chip *tpm_register_hardware(struct device *dev,
>
>   	return chip;
>
> +put_device:
> +	put_device(chip->dev);
>   out_free:
>   	kfree(chip);
>   	kfree(devname);
Thanks Wanlong, will merge and send James through a git-pull today.


      reply	other threads:[~2012-05-23 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16  8:24 [PATCH] tpm: fix memleak when register hardware fails Wanlong Gao
2012-05-23 15:31 ` Rajiv Andrade [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=4FBD02CC.4080600@linux.vnet.ibm.com \
    --to=srajiv@linux.vnet.ibm.com \
    --cc=debora@linux.vnet.ibm.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox