HDMI: 3288/3368: hdcp check firmware pointer.
authorZheng Yang <zhengyang@rock-chips.com>
Mon, 4 May 2015 08:26:33 +0000 (16:26 +0800)
committerZheng Yang <zhengyang@rock-chips.com>
Tue, 5 May 2015 04:26:55 +0000 (12:26 +0800)
If firmware is NULL, HDCP is disabled.

Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hdcp.c

index 0e5a76c55d2463869cad492721357026a2e96454..6beeaf1bebdeb0e9813b1d7be78d7bcf99146616 100644 (file)
@@ -88,6 +88,10 @@ static void hdcp_load_keys_cb(const struct firmware *fw,
 {
        struct hdmi *hdmi = (struct hdmi *)context;
 
+       if (fw == NULL) {
+               pr_info("HDCP: firmware is not loaded\n");
+               return;
+       }
        if (fw->size < HDCP_KEY_SIZE) {
                pr_err("HDCP: firmware wrong size %d\n", (int)fw->size);
                return;
@@ -238,7 +242,10 @@ static ssize_t hdcp_enable_write(struct device *device,
 
        if (hdcp == NULL)
                return -EINVAL;
-
+       if (hdcp->keys == NULL) {
+               pr_err("HDCP: key is not loaded\n");
+               return -EINVAL;
+       }
        if (kstrtoint(buf, 0, &enable))
                return -EINVAL;