Re: Re: [PATCH v2] ide: Check for null pointer after calling devm_ioremap

From: Jiasheng Jiang
Date: Fri Jan 07 2022 - 06:48:33 EST


On Fri, Jan 07, 2022 at 05:28:59PM +0800, David Laight wrote:
> That !!alt_base doesn't look right.
> Without looking at the rest of the code maybe:
> if (!base && !alt_base)
> may be correct.

Thanks, that's my fault.
I will correct it.

> It also rather makes me wonder about the actual failure return value.
> If devm_ioport_map() returns a 'port number' for inb()/outb() then
> zero is technically a valid value!

That's not right.
The devm_ioport_map() returns NULL if fails and returns non-NULL
pointer if success.
And also we can find in `drivers/ata/pata_platform.c` that it also
use the same way to check the return value from devm_ioport_map().

I will submit a new version to correct my code.

Sincerely thanks,
Jiang