mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Marcel Selhorst <selhorst@crypto.rub.de>
Cc: linux-kernel@vger.kernel.org, castet.matthieu@free.fr, kjhall@us.ibm.com
Subject: Re: [PATCH] Infineon TPM: move infineon driver off pci_dev
Date: Thu, 27 Oct 2005 14:33:32 -0700	[thread overview]
Message-ID: <20051027143332.08269850.akpm@osdl.org> (raw)
In-Reply-To: <4360B889.1010502@crypto.rub.de>

Marcel Selhorst <selhorst@crypto.rub.de> wrote:
>
> @@ -489,67 +464,51 @@ static int __devinit tpm_inf_probe(struc
>  			 "product id %02x%02x"
>  			 "%s\n",
>  			 TPM_INF_ADDR,
> -			 tpm_inf.base,
> +			 TPM_INF_BASE,
>  			 version[0], version[1],
>  			 vendorid[0], vendorid[1],
>  			 productid[0], productid[1], chipname);
> 
> -		rc = tpm_register_hardware(&pci_dev->dev, &tpm_inf);
> -		if (rc < 0)
> -			goto error;
> +		rc = tpm_register_hardware(&dev->dev, &tpm_inf);
> +		if (rc < 0) {
> +			release_region(tpm_inf.base, TPM_INF_PORT_LEN);
> +			return -ENODEV;
> +		}
>  		return 0;
>  	} else {
> -		dev_info(&pci_dev->dev, "No Infineon TPM found!\n");
> -error:
> -		pnp_unregister_driver(&tpm_inf_pnp);
> -error2:
> -		pci_disable_device(pci_dev);
> -		pnp_registered = 0;
> +		dev_info(&dev->dev, "No Infineon TPM found!\n");
>  		return -ENODEV;
>  	}
>  }

This final return will leak the I/O region from request_region().

To reduce the chance of this happening again, please send a followup patch
which prevents this function from having `return' statements sprinkled all
over it.  An example would be drivers/net/8139cp.c:cp_init_one(), thanks.

If for some reason the leak is deliberate then a comment is needed.

  parent reply	other threads:[~2005-10-27 21:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-26 17:11 Marcel Selhorst
2005-10-26 17:23 ` Kylene Jo Hall
2005-10-26 17:41 ` matthieu castet
2005-10-26 19:53   ` Marcel Selhorst
2005-10-27 11:22   ` Marcel Selhorst
2005-10-27 14:07     ` Kylene Jo Hall
2005-10-27 21:55       ` Andrew Morton
2005-10-27 22:03         ` Roland Dreier
2005-10-27 22:26           ` Andrew Morton
2005-10-28 14:22             ` Kylene Jo Hall
2005-11-11 20:11         ` [PATCH] TPM: cleanups Kylene Jo Hall
2005-11-11 23:08           ` Kylene Jo Hall
2005-11-12 21:48             ` Andrew Morton
2005-11-16 22:48               ` Kylene Jo Hall
2005-10-27 21:33     ` Andrew Morton [this message]
2005-10-28  5:23       ` [PATCH] Infineon TPM: move infineon driver off pci_dev Marcel Selhorst
2005-10-27 21:42     ` matthieu castet

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=20051027143332.08269850.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=castet.matthieu@free.fr \
    --cc=kjhall@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=selhorst@crypto.rub.de \
    /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

all inboxes | Powered by JetHome®