Commit 7e476071 authored by Jiasheng Jiang's avatar Jiasheng Jiang Committed by Kalle Valo

ray_cs: Check ioremap return value

As the possible failure of the ioremap(), the 'local->sram' and other
two could be NULL.
Therefore it should be better to check it in order to avoid the later
dev_dbg.

Fixes: 1da177e4 ("Linux-2.6.12-rc2")
Signed-off-by: default avatarJiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211230022926.1846757-1-jiasheng@iscas.ac.cn
parent fe683fae
...@@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) ...@@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed; goto failed;
local->sram = ioremap(link->resource[2]->start, local->sram = ioremap(link->resource[2]->start,
resource_size(link->resource[2])); resource_size(link->resource[2]));
if (!local->sram)
goto failed;
/*** Set up 16k window for shared memory (receive buffer) ***************/ /*** Set up 16k window for shared memory (receive buffer) ***************/
link->resource[3]->flags |= link->resource[3]->flags |=
...@@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) ...@@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed; goto failed;
local->rmem = ioremap(link->resource[3]->start, local->rmem = ioremap(link->resource[3]->start,
resource_size(link->resource[3])); resource_size(link->resource[3]));
if (!local->rmem)
goto failed;
/*** Set up window for attribute memory ***********************************/ /*** Set up window for attribute memory ***********************************/
link->resource[4]->flags |= link->resource[4]->flags |=
...@@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) ...@@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed; goto failed;
local->amem = ioremap(link->resource[4]->start, local->amem = ioremap(link->resource[4]->start,
resource_size(link->resource[4])); resource_size(link->resource[4]));
if (!local->amem)
goto failed;
dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram); dev_dbg(&link->dev, "ray_config sram=%p\n", local->sram);
dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem); dev_dbg(&link->dev, "ray_config rmem=%p\n", local->rmem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment