[PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



devm_memremap() never returns NULL pointer, it will return
ERR_PTR() when it fails, so replace the check with IS_ERR().

Fixes: b0474a20b153 ("tpm: Add reserved memory event log")
Signed-off-by: Yang Yingliang <yangyingliang@xxxxxxxxxx>
---
 drivers/char/tpm/eventlog/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/eventlog/of.c b/drivers/char/tpm/eventlog/of.c
index c815cadf00a4..6a818a026c94 100644
--- a/drivers/char/tpm/eventlog/of.c
+++ b/drivers/char/tpm/eventlog/of.c
@@ -43,7 +43,7 @@ static int tpm_read_log_memory_region(struct tpm_chip *chip)
 
 	chip->log.bios_event_log = devm_memremap(&chip->dev, res.start, resource_size(&res),
 						 MEMREMAP_WB);
-	if (!chip->log.bios_event_log) {
+	if (IS_ERR(chip->log.bios_event_log)) {
 		dev_info(&chip->dev, "err memremap\n");
 		return -ENOMEM;
 	}
-- 
2.25.1




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux