All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem
@ 2021-04-20  3:10 Tian Tao
  2021-04-27 23:44 ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Tian Tao @ 2021-04-20  3:10 UTC (permalink / raw)
  To: peterhuewe, jarkko; +Cc: linux-integrity, Tian Tao

Function returns 'void __iomem *' so use IOMEM_ERR_PTR for returning
an error.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/char/tpm/tpm_crb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
index a9dcf31..1860665 100644
--- a/drivers/char/tpm/tpm_crb.c
+++ b/drivers/char/tpm/tpm_crb.c
@@ -464,7 +464,7 @@ static void __iomem *crb_map_res(struct device *dev, struct resource *iores,
 
 	/* Detect a 64 bit address on a 32 bit system */
 	if (start != new_res.start)
-		return (void __iomem *) ERR_PTR(-EINVAL);
+		return IOMEM_ERR_PTR(-EINVAL);
 
 	if (!iores)
 		return devm_ioremap_resource(dev, &new_res);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem
  2021-04-20  3:10 [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem Tian Tao
@ 2021-04-27 23:44 ` Jarkko Sakkinen
  2021-04-28  8:43   ` tiantao (H)
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2021-04-27 23:44 UTC (permalink / raw)
  To: Tian Tao; +Cc: peterhuewe, linux-integrity

On Tue, Apr 20, 2021 at 11:10:45AM +0800, Tian Tao wrote:
> Function returns 'void __iomem *' so use IOMEM_ERR_PTR for returning
> an error.

You should also tell why we want to to use IOMEM_ERR_PTR in the
description. If it makes sense, then you should know why it makes
sense.

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  drivers/char/tpm/tpm_crb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
> index a9dcf31..1860665 100644
> --- a/drivers/char/tpm/tpm_crb.c
> +++ b/drivers/char/tpm/tpm_crb.c
> @@ -464,7 +464,7 @@ static void __iomem *crb_map_res(struct device *dev, struct resource *iores,
>  
>  	/* Detect a 64 bit address on a 32 bit system */
>  	if (start != new_res.start)
> -		return (void __iomem *) ERR_PTR(-EINVAL);
> +		return IOMEM_ERR_PTR(-EINVAL);
>  
>  	if (!iores)
>  		return devm_ioremap_resource(dev, &new_res);
> -- 
> 2.7.4
> 
> 

/Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem
  2021-04-27 23:44 ` Jarkko Sakkinen
@ 2021-04-28  8:43   ` tiantao (H)
  2021-04-29  6:48     ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: tiantao (H) @ 2021-04-28  8:43 UTC (permalink / raw)
  To: Jarkko Sakkinen, Tian Tao; +Cc: peterhuewe, linux-integrity


在 2021/4/28 7:44, Jarkko Sakkinen 写道:
> On Tue, Apr 20, 2021 at 11:10:45AM +0800, Tian Tao wrote:
>> Function returns 'void __iomem *' so use IOMEM_ERR_PTR for returning
>> an error.
> You should also tell why we want to to use IOMEM_ERR_PTR in the
> description. If it makes sense, then you should know why it makes
> sense.

thank for review the code ,I'll send a v2 to update the commit message.

This is to simplify the code, the definition of IOMEM_ERR_PTR is in 
include/linux/io.h

#define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)

I'll send it to v2 and put the above sentence in the commit messge, what 
do you think?

>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> ---
>>   drivers/char/tpm/tpm_crb.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/char/tpm/tpm_crb.c b/drivers/char/tpm/tpm_crb.c
>> index a9dcf31..1860665 100644
>> --- a/drivers/char/tpm/tpm_crb.c
>> +++ b/drivers/char/tpm/tpm_crb.c
>> @@ -464,7 +464,7 @@ static void __iomem *crb_map_res(struct device *dev, struct resource *iores,
>>   
>>   	/* Detect a 64 bit address on a 32 bit system */
>>   	if (start != new_res.start)
>> -		return (void __iomem *) ERR_PTR(-EINVAL);
>> +		return IOMEM_ERR_PTR(-EINVAL);
>>   
>>   	if (!iores)
>>   		return devm_ioremap_resource(dev, &new_res);
>> -- 
>> 2.7.4
>>
>>
> /Jarkko
> .
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem
  2021-04-28  8:43   ` tiantao (H)
@ 2021-04-29  6:48     ` Jarkko Sakkinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2021-04-29  6:48 UTC (permalink / raw)
  To: tiantao (H); +Cc: Tian Tao, peterhuewe, linux-integrity

On Wed, Apr 28, 2021 at 04:43:46PM +0800, tiantao (H) wrote:
> 
> 在 2021/4/28 7:44, Jarkko Sakkinen 写道:
> > On Tue, Apr 20, 2021 at 11:10:45AM +0800, Tian Tao wrote:
> > > Function returns 'void __iomem *' so use IOMEM_ERR_PTR for returning
> > > an error.
> > You should also tell why we want to to use IOMEM_ERR_PTR in the
> > description. If it makes sense, then you should know why it makes
> > sense.
> 
> thank for review the code ,I'll send a v2 to update the commit message.
> 
> This is to simplify the code, the definition of IOMEM_ERR_PTR is in
> include/linux/io.h
> 
> #define IOMEM_ERR_PTR(err) (__force void __iomem *)ERR_PTR(err)
> 
> I'll send it to v2 and put the above sentence in the commit messge, what do
> you think?

I don't pre-ack patches.

/Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-29  6:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20  3:10 [PATCH] tpm_crb: Use IOMEM_ERR_PTR when function returns iomem Tian Tao
2021-04-27 23:44 ` Jarkko Sakkinen
2021-04-28  8:43   ` tiantao (H)
2021-04-29  6:48     ` Jarkko Sakkinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.