Commit 73e3f1eb authored by Kiran Padwal's avatar Kiran Padwal Committed by Mark Brown

spi: pl022: Add missing error check for devm_kzalloc

Currently this driver is missing a check on the return value of devm_kzalloc,
which would cause a NULL pointer dereference in a OOM situation.

This patch adds a missing check.
Signed-off-by: default avatarKiran Padwal <kiran.padwal@smartplayin.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7d1311b9
...@@ -2100,6 +2100,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2100,6 +2100,10 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
pl022->vendor = id->data; pl022->vendor = id->data;
pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int), pl022->chipselects = devm_kzalloc(dev, num_cs * sizeof(int),
GFP_KERNEL); GFP_KERNEL);
if (!pl022->chipselects) {
status = -ENOMEM;
goto err_no_mem;
}
/* /*
* Bus Number Which has been Assigned to this SSP controller * Bus Number Which has been Assigned to this SSP controller
...@@ -2241,6 +2245,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id) ...@@ -2241,6 +2245,7 @@ static int pl022_probe(struct amba_device *adev, const struct amba_id *id)
amba_release_regions(adev); amba_release_regions(adev);
err_no_ioregion: err_no_ioregion:
err_no_gpio: err_no_gpio:
err_no_mem:
spi_master_put(master); spi_master_put(master);
return status; return status;
} }
......
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