diff mbox series

[RESEND] ata: palmld: fix return value check in palmld_pata_probe()

Message ID 20221029074931.3189275-1-yangyingliang@huawei.com
State New
Headers show
Series [RESEND] ata: palmld: fix return value check in palmld_pata_probe() | expand

Commit Message

Yang Yingliang Oct. 29, 2022, 7:49 a.m. UTC
If devm_platform_ioremap_resource() fails, it never return
NULL pointer, replace the check with IS_ERR().

Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
---
The previous patch link:
https://lore.kernel.org/lkml/15e09c18-792b-931c-11c7-5ef284490eba@huawei.com/T/#t
---
 drivers/ata/pata_palmld.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Damien Le Moal Oct. 31, 2022, 5:46 a.m. UTC | #1
On 10/29/22 16:49, Yang Yingliang wrote:
> If devm_platform_ioremap_resource() fails, it never return
> NULL pointer, replace the check with IS_ERR().
> 
> Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> ---
> The previous patch link:
> https://lore.kernel.org/lkml/15e09c18-792b-931c-11c7-5ef284490eba@huawei.com/T/#t
> ---
>  drivers/ata/pata_palmld.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
> index 400e65190904..51caa2a427dd 100644
> --- a/drivers/ata/pata_palmld.c
> +++ b/drivers/ata/pata_palmld.c
> @@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
>  
>  	/* remap drive's physical memory address */
>  	mem = devm_platform_ioremap_resource(pdev, 0);
> -	if (!mem)
> -		return -ENOMEM;
> +	if (IS_ERR(mem))
> +		return PTR_ERR(mem);
>  
>  	/* request and activate power and reset GPIOs */
>  	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);

Arnd has a series of patches that removes this driver from the kernel in
6.2. Do you need this fix for a stable release ?
Yang Yingliang Oct. 31, 2022, 8:13 a.m. UTC | #2
Hi,

On 2022/10/31 13:46, Damien Le Moal wrote:
> On 10/29/22 16:49, Yang Yingliang wrote:
>> If devm_platform_ioremap_resource() fails, it never return
>> NULL pointer, replace the check with IS_ERR().
>>
>> Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
>> ---
>> The previous patch link:
>> https://lore.kernel.org/lkml/15e09c18-792b-931c-11c7-5ef284490eba@huawei.com/T/#t
>> ---
>>   drivers/ata/pata_palmld.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
>> index 400e65190904..51caa2a427dd 100644
>> --- a/drivers/ata/pata_palmld.c
>> +++ b/drivers/ata/pata_palmld.c
>> @@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
>>   
>>   	/* remap drive's physical memory address */
>>   	mem = devm_platform_ioremap_resource(pdev, 0);
>> -	if (!mem)
>> -		return -ENOMEM;
>> +	if (IS_ERR(mem))
>> +		return PTR_ERR(mem);
>>   
>>   	/* request and activate power and reset GPIOs */
>>   	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
> Arnd has a series of patches that removes this driver from the kernel in
> 6.2. Do you need this fix for a stable release ?
It's nice that you can merge this patch. If you don't take this, it's 
not a big problem.

Thanks,
Yang
>
Damien Le Moal Oct. 31, 2022, 9:22 a.m. UTC | #3
On 10/31/22 17:13, Yang Yingliang wrote:
> Hi,
> 
> On 2022/10/31 13:46, Damien Le Moal wrote:
>> On 10/29/22 16:49, Yang Yingliang wrote:
>>> If devm_platform_ioremap_resource() fails, it never return
>>> NULL pointer, replace the check with IS_ERR().
>>>
>>> Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>>> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
>>> ---
>>> The previous patch link:
>>> https://lore.kernel.org/lkml/15e09c18-792b-931c-11c7-5ef284490eba@huawei.com/T/#t
>>> ---
>>>   drivers/ata/pata_palmld.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
>>> index 400e65190904..51caa2a427dd 100644
>>> --- a/drivers/ata/pata_palmld.c
>>> +++ b/drivers/ata/pata_palmld.c
>>> @@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device
>>> *pdev)
>>>         /* remap drive's physical memory address */
>>>       mem = devm_platform_ioremap_resource(pdev, 0);
>>> -    if (!mem)
>>> -        return -ENOMEM;
>>> +    if (IS_ERR(mem))
>>> +        return PTR_ERR(mem);
>>>         /* request and activate power and reset GPIOs */
>>>       lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
>> Arnd has a series of patches that removes this driver from the kernel in
>> 6.2. Do you need this fix for a stable release ?
> It's nice that you can merge this patch. If you don't take this, it's
> not a big problem.

Sorry, I got confused. This is a bug fix, so I will apply it to
for-6.1-fixes. I was thinking about 6.2, but the driver will then be gone.

> 
> Thanks,
> Yang
>>
Damien Le Moal Nov. 2, 2022, 7:34 a.m. UTC | #4
On 10/29/22 16:49, Yang Yingliang wrote:
> If devm_platform_ioremap_resource() fails, it never return
> NULL pointer, replace the check with IS_ERR().
> 
> Fixes: 57bf0f5a162d ("ARM: pxa: use pdev resource for palmld mmio")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
> Acked-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>

Applied to for-6.1-fixes. Thanks !

> ---
> The previous patch link:
> https://lore.kernel.org/lkml/15e09c18-792b-931c-11c7-5ef284490eba@huawei.com/T/#t
> ---
>  drivers/ata/pata_palmld.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
> index 400e65190904..51caa2a427dd 100644
> --- a/drivers/ata/pata_palmld.c
> +++ b/drivers/ata/pata_palmld.c
> @@ -63,8 +63,8 @@ static int palmld_pata_probe(struct platform_device *pdev)
>  
>  	/* remap drive's physical memory address */
>  	mem = devm_platform_ioremap_resource(pdev, 0);
> -	if (!mem)
> -		return -ENOMEM;
> +	if (IS_ERR(mem))
> +		return PTR_ERR(mem);
>  
>  	/* request and activate power and reset GPIOs */
>  	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
diff mbox series

Patch

diff --git a/drivers/ata/pata_palmld.c b/drivers/ata/pata_palmld.c
index 400e65190904..51caa2a427dd 100644
--- a/drivers/ata/pata_palmld.c
+++ b/drivers/ata/pata_palmld.c
@@ -63,8 +63,8 @@  static int palmld_pata_probe(struct platform_device *pdev)
 
 	/* remap drive's physical memory address */
 	mem = devm_platform_ioremap_resource(pdev, 0);
-	if (!mem)
-		return -ENOMEM;
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
 
 	/* request and activate power and reset GPIOs */
 	lda->power = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);