diff mbox series

[-next] coresight: tpda: fix return value check in tpda_probe()

Message ID 20230129084246.537694-1-yangyingliang@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] coresight: tpda: fix return value check in tpda_probe() | expand

Commit Message

Yang Yingliang Jan. 29, 2023, 8:42 a.m. UTC
devm_ioremap_resource() never returns NULL pointer, it
will return ERR_PTR() when it fails, so replace the check
with IS_ERR().

Fixes: 5b7916625c01 ("Coresight: Add TPDA link driver")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/hwtracing/coresight/coresight-tpda.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Suzuki K Poulose Jan. 30, 2023, 9:40 a.m. UTC | #1
On 29/01/2023 08:42, Yang Yingliang wrote:
> devm_ioremap_resource() never returns NULL pointer, it
> will return ERR_PTR() when it fails, so replace the check
> with IS_ERR().

Thanks for the patch.
> 
> Fixes: 5b7916625c01 ("Coresight: Add TPDA link driver")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>   drivers/hwtracing/coresight/coresight-tpda.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
> index 19c25c9f6157..6313b12880e0 100644
> --- a/drivers/hwtracing/coresight/coresight-tpda.c
> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
> @@ -145,7 +145,7 @@ static int tpda_probe(struct amba_device *adev, const struct amba_id *id)
>   	dev_set_drvdata(dev, drvdata);
>   
>   	base = devm_ioremap_resource(dev, &adev->res);
> -	if (!base)
> +	if (IS_ERR(base))
>   		return -ENOMEM;

I have fixed this up to :

		return PTR_ERR(base);

for consistency.

Thanks
Suzuki
Yang Yingliang Jan. 30, 2023, 12:12 p.m. UTC | #2
On 2023/1/30 17:40, Suzuki K Poulose wrote:
> On 29/01/2023 08:42, Yang Yingliang wrote:
>> devm_ioremap_resource() never returns NULL pointer, it
>> will return ERR_PTR() when it fails, so replace the check
>> with IS_ERR().
>
> Thanks for the patch.
>>
>> Fixes: 5b7916625c01 ("Coresight: Add TPDA link driver")
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-tpda.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-tpda.c 
>> b/drivers/hwtracing/coresight/coresight-tpda.c
>> index 19c25c9f6157..6313b12880e0 100644
>> --- a/drivers/hwtracing/coresight/coresight-tpda.c
>> +++ b/drivers/hwtracing/coresight/coresight-tpda.c
>> @@ -145,7 +145,7 @@ static int tpda_probe(struct amba_device *adev, 
>> const struct amba_id *id)
>>       dev_set_drvdata(dev, drvdata);
>>         base = devm_ioremap_resource(dev, &adev->res);
>> -    if (!base)
>> +    if (IS_ERR(base))
>>           return -ENOMEM;
>
> I have fixed this up to :
>
>         return PTR_ERR(base);
>
> for consistency.
Yes, it should  be PTR_ERR().

Thanks,
Yang
>
> Thanks
> Suzuki
>
>
> .
diff mbox series

Patch

diff --git a/drivers/hwtracing/coresight/coresight-tpda.c b/drivers/hwtracing/coresight/coresight-tpda.c
index 19c25c9f6157..6313b12880e0 100644
--- a/drivers/hwtracing/coresight/coresight-tpda.c
+++ b/drivers/hwtracing/coresight/coresight-tpda.c
@@ -145,7 +145,7 @@  static int tpda_probe(struct amba_device *adev, const struct amba_id *id)
 	dev_set_drvdata(dev, drvdata);
 
 	base = devm_ioremap_resource(dev, &adev->res);
-	if (!base)
+	if (IS_ERR(base))
 		return -ENOMEM;
 	drvdata->base = base;