From: Jes Sorensen Date: Sat, 26 Apr 2014 16:54:54 +0000 (+0200) Subject: staging: rtl8723au: c2h_wk_callback(): Use GFP_KERNEL, and check return value X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fbde4129175fd2896ffc9c5363ee1a7a65541e76;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: rtl8723au: c2h_wk_callback(): Use GFP_KERNEL, and check return value It is safe to use GFP_KERNEL in a workqueue handler, and check the return value. If the malloc fails, skip and try again. Reported-by: Dan Carpenter Signed-off-by: Jes Sorensen Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723au/core/rtw_cmd.c b/drivers/staging/rtl8723au/core/rtw_cmd.c index cb15ddaae12e..068374a911fc 100644 --- a/drivers/staging/rtl8723au/core/rtw_cmd.c +++ b/drivers/staging/rtl8723au/core/rtw_cmd.c @@ -1536,7 +1536,9 @@ static void c2h_wk_callback(struct work_struct *work) /* This C2H event is read, clear it */ c2h_evt_clear23a(adapter); } else if ((c2h_evt = (struct c2h_evt_hdr *) - kmalloc(16, GFP_ATOMIC))) { + kmalloc(16, GFP_KERNEL))) { + if (!c2h_evt) + continue; /* This C2H event is not read, read & clear now */ if (c2h_evt_read23a(adapter, (u8*)c2h_evt) != _SUCCESS) continue;