hdmitx: fix wrong kmalloc usage
authorZongdong Jiao <zongdong.jiao@amlogic.com>
Thu, 8 Mar 2018 09:05:25 +0000 (17:05 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Fri, 9 Mar 2018 11:20:56 +0000 (03:20 -0800)
PD#161652: fix wrong kmailloc(, GFP_KERNEL) usage
At timer function. System will throw
    [<ffffff800908a0d8>] dump_backtrace+0x0/0x1d0
    [<ffffff800908a2cc>] show_stack+0x24/0x30
    [<ffffff8009465c60>] dump_stack+0x90/0xb0
    [<ffffff80090cc2e4>] ___might_sleep+0x14c/0x1a0
    [<ffffff80090cc394>] __might_sleep+0x5c/0x98
    [<ffffff80091e4ecc>] kmem_cache_alloc_trace+0x1ec/0x238
    [<ffffff800979d18c>] hdcptx_events_handle+0x45c/0x640
    [<ffffff800911193c>] call_timer_fn+0x3c/0x1b0
    [<ffffff8009111bb8>] expire_timers+0xd8/0x178
    [<ffffff8009111cec>] run_timer_softirq+0x94/0x178
    [<ffffff800908183c>] __do_softirq+0x12c/0x344
    [<ffffff80090a5344>] irq_exit+0xa4/0xd0
    [<ffffff80090fc8d8>] __handle_domain_irq+0x90/0x100
    [<ffffff800908154c>] gic_handle_irq+0x5c/0xb0
Should use GFP_ATOMIC instead.

Change-Id: I70778a6e3d993d87f71be208503688286913bda1
Signed-off-by: Zongdong Jiao <zongdong.jiao@amlogic.com>
drivers/amlogic/media/vout/hdmitx/hdmi_tx_20/hw/hdmi_tx_hw.c

index ed5c91a..5879a32 100644 (file)
@@ -3081,7 +3081,7 @@ static void hdcp_ksv_print(void)
        unsigned int i, pos;
        unsigned char *tmp_buf = NULL;
 
-       tmp_buf = kmalloc(2000, GFP_KERNEL);
+       tmp_buf = kmalloc(2000, GFP_ATOMIC);
        if (!tmp_buf)
                return;
 
@@ -3110,7 +3110,7 @@ static void hdcp_ksv_sha1_calc(struct hdmitx_dev *hdev)
        int j = 0;
 
        /* 0x165e: Page 95 */
-       hdcp_mKsvListBuf = kmalloc(0x1660, GFP_KERNEL);
+       hdcp_mKsvListBuf = kmalloc(0x1660, GFP_ATOMIC);
        if (hdcp_mKsvListBuf) {
                /* KSV_LEN; */
                list = hdmitx_rd_reg(HDMITX_DWC_HDCP_BSTATUS_0) & KSV_MSK;