diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-12-29 22:21:15 +0100 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2016-01-01 03:33:42 +0100 |
commit | 427cc61a4486fa80eccaad2bdfcc50cfd1b46625 (patch) | |
tree | aebf7116d2457bb18ea94f2286388f29330f66d7 /drivers/ata/sata_sx4.c | |
parent | ata: ahci_brcmstb: add support for MIPS-based platforms (diff) | |
download | linux-427cc61a4486fa80eccaad2bdfcc50cfd1b46625.tar.xz linux-427cc61a4486fa80eccaad2bdfcc50cfd1b46625.zip |
sata_sx4: correctly handling failed allocation
Since kzalloc can be failed in memory pressure, return error when failed.
Signed-off-by: Insu Yun <wuninsu@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/sata_sx4.c')
-rw-r--r-- | drivers/ata/sata_sx4.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/ata/sata_sx4.c b/drivers/ata/sata_sx4.c index fab504fd9cfd..48301cb3a316 100644 --- a/drivers/ata/sata_sx4.c +++ b/drivers/ata/sata_sx4.c @@ -1396,6 +1396,8 @@ static unsigned int pdc20621_dimm_init(struct ata_host *host) addr = 0; length = size * 1024 * 1024; buf = kzalloc(ECC_ERASE_BUF_SZ, GFP_KERNEL); + if (!buf) + return 1; while (addr < length) { pdc20621_put_to_dimm(host, buf, addr, ECC_ERASE_BUF_SZ); |