On Wed, 07 Mar 2007 10:58:10 -0700
Alex Williamson <[EMAIL PROTECTED]> 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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to