From: Insu Yun Date: Tue, 29 Dec 2015 21:21:15 +0000 (-0500) Subject: sata_sx4: correctly handling failed allocation X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=427cc61a4486fa80eccaad2bdfcc50cfd1b46625;p=linux-beck.git sata_sx4: correctly handling failed allocation Since kzalloc can be failed in memory pressure, return error when failed. Signed-off-by: Insu Yun Signed-off-by: Tejun Heo --- 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);