Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1266060

Re: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register()

From Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Newsgroups linux.kernel
Subject Re: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register()
Date 2015-11-09 23:50 +0100
Message-ID <qt3qa-4MA-9@gated-at.bofh.it> (permalink)
References <qst3k-5HG-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Nov 08, 2015 at 09:51:07AM +0200, Jarkko Sakkinen wrote:
> +		if (rc && rc != -ENOENT) {
> +			tpm_chip_unregister(chip);
> +			return rc;
> +		}
> +	}

This is still goofy looking, the list_add_tail_rcu should be the last
thing done and cannot fail. Just code this with the usual goto based
unwind and goto to do tpm_dev_del_device for the above failure.

> +
>  	return 0;
>  out_err:
>  	tpm1_chip_unregister(chip);

Which avoids calling tpm1_chip_unregister and tpm_chip_unregister in
the same function, which looks so wrong to a casual read..

Jason
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-08 09:00 +0100
  Re: [PATCH] tpm: fix compat 'ppi' link handling in  tpm_chip_register() Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2015-11-09 23:50 +0100
    Re: [PATCH] tpm: fix compat 'ppi' link handling in  tpm_chip_register() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-10 05:10 +0100
  Re: [PATCH] tpm: fix compat 'ppi' link handling in  tpm_chip_register() Jeremiah Mahler <jmmahler@gmail.com> - 2015-11-10 07:20 +0100
    Re: [PATCH] tpm: fix compat 'ppi' link handling in  tpm_chip_register() Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2015-11-10 07:20 +0100

csiph-web