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>
This commit is contained in:
Insu Yun 2015-12-29 16:21:15 -05:00 committed by Tejun Heo
parent 1980eb9bd7
commit 427cc61a44
1 changed files with 2 additions and 0 deletions

View File

@ -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);