|
@@ -666,18 +666,20 @@ EXPORT_SYMBOL_GPL(tpm_show_temp_deactivated);
|
|
*/
|
|
*/
|
|
static struct tpm_chip *tpm_chip_find_get(int chip_num)
|
|
static struct tpm_chip *tpm_chip_find_get(int chip_num)
|
|
{
|
|
{
|
|
- struct tpm_chip *pos;
|
|
|
|
|
|
+ struct tpm_chip *pos, *chip = NULL;
|
|
|
|
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
list_for_each_entry_rcu(pos, &tpm_chip_list, list) {
|
|
list_for_each_entry_rcu(pos, &tpm_chip_list, list) {
|
|
if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
|
|
if (chip_num != TPM_ANY_NUM && chip_num != pos->dev_num)
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if (try_module_get(pos->dev->driver->owner))
|
|
|
|
|
|
+ if (try_module_get(pos->dev->driver->owner)) {
|
|
|
|
+ chip = pos;
|
|
break;
|
|
break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
rcu_read_unlock();
|
|
rcu_read_unlock();
|
|
- return pos;
|
|
|
|
|
|
+ return chip;
|
|
}
|
|
}
|
|
|
|
|
|
#define TPM_ORDINAL_PCRREAD cpu_to_be32(21)
|
|
#define TPM_ORDINAL_PCRREAD cpu_to_be32(21)
|