lkml.org 
[lkml]   [2015]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tpm: fix compat 'ppi' link handling in tpm_chip_register()
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


\
 
 \ /
  Last update: 2015-11-10 00:01    [W:0.067 / U:0.936 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site