* [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region()
@ 2023-01-29 7:26 Yang Yingliang
2023-02-08 1:18 ` Jarkko Sakkinen
0 siblings, 1 reply; 4+ messages in thread
From: Yang Yingliang @ 2023-01-29 7:26 UTC (permalink / raw)
To: linux-integrity; +Cc: peterhuewe, jarkko, jgg, eajames, yangyingliang
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@huawei.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region()
2023-01-29 7:26 [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region() Yang Yingliang
@ 2023-02-08 1:18 ` Jarkko Sakkinen
2023-02-08 1:26 ` Jarkko Sakkinen
0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-02-08 1:18 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-integrity, peterhuewe, jgg, eajames
On Sun, Jan 29, 2023 at 03:26:37PM +0800, Yang Yingliang wrote:
> 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@huawei.com>
> ---
> 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
>
Thanks. I will squash this with the patch and add your sob.
BR, Jarkko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region()
2023-02-08 1:18 ` Jarkko Sakkinen
@ 2023-02-08 1:26 ` Jarkko Sakkinen
2023-02-08 1:31 ` Jarkko Sakkinen
0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-02-08 1:26 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-integrity, peterhuewe, jgg, eajames
On Wed, Feb 08, 2023 at 03:18:45AM +0200, Jarkko Sakkinen wrote:
> On Sun, Jan 29, 2023 at 03:26:37PM +0800, Yang Yingliang wrote:
> > 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@huawei.com>
> > ---
> > 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
> >
>
> Thanks. I will squash this with the patch and add your sob.
Ugh, in the review three dev_info()'s went out of my radar.
They make no sense so I'll drop them.
BR, Jarkko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region()
2023-02-08 1:26 ` Jarkko Sakkinen
@ 2023-02-08 1:31 ` Jarkko Sakkinen
0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-02-08 1:31 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-integrity, peterhuewe, jgg, eajames
On Wed, Feb 08, 2023 at 03:26:51AM +0200, Jarkko Sakkinen wrote:
> On Wed, Feb 08, 2023 at 03:18:45AM +0200, Jarkko Sakkinen wrote:
> > On Sun, Jan 29, 2023 at 03:26:37PM +0800, Yang Yingliang wrote:
> > > 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@huawei.com>
> > > ---
> > > 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
> > >
> >
> > Thanks. I will squash this with the patch and add your sob.
>
> Ugh, in the review three dev_info()'s went out of my radar.
>
> They make no sense so I'll drop them.
tpm: Add reserved memory event log
Some platforms may desire to pass the event log up to Linux in the
form of a reserved memory region. In particular, this is desirable
for embedded systems or baseboard management controllers (BMCs)
booting with U-Boot. IBM OpenBMC BMCs will be the first user.
Add support for the reserved memory in the TPM core to find the
region and map it.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
[jarkko: removed spurious dev_info()'s from tpm_read_log_memory_region()]
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
[yang: return -ENOMEM when devm_memremap() fails]
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
BR, Jarkko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-08 1:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-29 7:26 [PATCH -next] tpm: of: fix return value check in tpm_read_log_memory_region() Yang Yingliang
2023-02-08 1:18 ` Jarkko Sakkinen
2023-02-08 1:26 ` Jarkko Sakkinen
2023-02-08 1:31 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).