Skip to content

Commit

Permalink
ray_cs: Check ioremap return value
Browse files Browse the repository at this point in the history
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: 1da177e ("Linux-2.6.12-rc2")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211230022926.1846757-1-jiasheng@iscas.ac.cn
  • Loading branch information
Jiasheng Jiang authored and Kalle Valo committed Feb 1, 2022
1 parent fe683fa commit 7e47607
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/wireless/ray_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed;
local->sram = ioremap(link->resource[2]->start,
resource_size(link->resource[2]));
if (!local->sram)
goto failed;

/*** Set up 16k window for shared memory (receive buffer) ***************/
link->resource[3]->flags |=
Expand All @@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed;
local->rmem = ioremap(link->resource[3]->start,
resource_size(link->resource[3]));
if (!local->rmem)
goto failed;

/*** Set up window for attribute memory ***********************************/
link->resource[4]->flags |=
Expand All @@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link)
goto failed;
local->amem = ioremap(link->resource[4]->start,
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 rmem=%p\n", local->rmem);
Expand Down

0 comments on commit 7e47607

Please sign in to comment.