aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/tpm/tpm.c')
-rw-r--r--drivers/char/tpm/tpm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c
index 62a5682578ca..ccdd828adcef 100644
--- a/drivers/char/tpm/tpm.c
+++ b/drivers/char/tpm/tpm.c
@@ -666,18 +666,20 @@ EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated);
666 */ 666 */
667static struct tpm_chip *tpm_chip_find_get(int chip_num) 667static struct tpm_chip *tpm_chip_find_get(int chip_num)
668{ 668{
669 struct tpm_chip *pos; 669 struct tpm_chip *pos, *chip = NULL;
670 670
671 rcu_read_lock(); 671 rcu_read_lock();
672 list_for_each_entry_rcu(pos, &tpm_chip_list, list) { 672 list_for_each_entry_rcu(pos, &tpm_chip_list, list) {
673 if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num) 673 if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
674 continue; 674 continue;
675 675
676 if (try_module_get(pos->dev->driver->owner)) 676 if (try_module_get(pos->dev->driver->owner)) {
677 chip = pos;
677 break; 678 break;
679 }
678 } 680 }
679 rcu_read_unlock(); 681 rcu_read_unlock();
680 return pos; 682 return chip;
681} 683}
682 684
683#define TPM_ORDINAL_PCRREAD cpu_to_be32(21) 685#define TPM_ORDINAL_PCRREAD cpu_to_be32(21)