public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alex Williamson <alex.williamson@hp.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Marcel Selhorst <tpm@selhorst.net>,
	Kylene Jo Hall <kjhall@us.ibm.com>
Subject: Re: [PATCH] tpm_infineon: add support for devices in mmio space
Date: Wed, 7 Mar 2007 13:33:26 -0800	[thread overview]
Message-ID: <20070307133326.fcf6f891.akpm@linux-foundation.org> (raw)
In-Reply-To: <1173290290.5941.204.camel@bling>

On Wed, 07 Mar 2007 10:58:10 -0700
Alex Williamson <alex.williamson@hp.com> wrote:

>  			 dev->name, dev_id->id);
> -		if (!((TPM_INF_BASE >> 8) & 0xff)) {
> +		if (!((tpm_dev.data_regs >> 8) & 0xff)) {
>  			rc = -EINVAL;
>  			goto err_last;
>  		}
>  		/* publish my base address and request region */
> -		if (request_region
> -		    (TPM_INF_BASE, TPM_INF_PORT_LEN, "tpm_infineon0") == NULL) {
> +		if (request_region(tpm_dev.data_regs, tpm_dev.data_size,
> +				   "tpm_infineon0") == NULL) {
>  			rc = -EINVAL;
>  			goto err_last;
>  		}
> -		if (request_region
> -		    (TPM_INF_ADDR, TPM_INF_ADDR_LEN, "tpm_infineon0") == NULL) {
> +		if (request_region(tpm_dev.config_port, tpm_dev.config_size,
> +				   "tpm_infineon0") == NULL) {
>  			rc = -EINVAL;
>  			goto err_last;
>  		}
> +	} else if (pnp_mem_valid(dev, 0) &&
> +	           !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) {
> +
> +	    	tpm_dev.iotype = TPM_INF_IO_MEM;
> +
> +		tpm_dev.map_base = pnp_mem_start(dev, 0);
> +		tpm_dev.map_size = pnp_mem_len(dev, 0);
> +
> +		dev_info(&dev->dev, "Found %s with ID %s\n",
> +			 dev->name, dev_id->id);
> +
> +		/* publish my base address and request region */
> +		if (request_mem_region(tpm_dev.map_base, tpm_dev.map_size,
> +				       "tpm_infineon0") == NULL) {
> +			rc = -EINVAL;
> +			goto err_last;
> +		}
> +
> +		tpm_dev.mem_base = ioremap(tpm_dev.map_base, tpm_dev.map_size);
> +		if (tpm_dev.mem_base == NULL) {
> +			rc = -EINVAL;
> +			goto err_last;
> +		}
>
> ...
>
> err_last:
>	return rc;
> }
	
tpm_inf_pnp_probe() leaks resources all over the place if something goes
wrong.


  reply	other threads:[~2007-03-07 21:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-07 17:58 [PATCH] tpm_infineon: add support for devices in mmio space Alex Williamson
2007-03-07 21:33 ` Andrew Morton [this message]
2007-03-07 21:52   ` Alex Williamson

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=20070307133326.fcf6f891.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alex.williamson@hp.com \
    --cc=kjhall@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpm@selhorst.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