From: hjc Date: Wed, 2 Apr 2014 08:07:11 +0000 (+0800) Subject: rk fb: fix ion free null point error X-Git-Tag: firefly_0821_release~5639 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=33775d48f421e29b0ed17d3a6a0837ecc6d234c7;p=firefly-linux-kernel-4.4.55.git rk fb: fix ion free null point error --- diff --git a/drivers/video/rockchip/rk_fb.c b/drivers/video/rockchip/rk_fb.c index 79cf85e3eed5..905b3195119f 100755 --- a/drivers/video/rockchip/rk_fb.c +++ b/drivers/video/rockchip/rk_fb.c @@ -1060,7 +1060,8 @@ void rk_fb_free_dma_buf(struct device *dev,struct rk_fb_reg_win_data *reg_win_da dma_buf_detach(area_data->dma_buf, area_data->attachment); dma_buf_put(area_data->dma_buf); #endif - ion_free(rk_fb->ion_client, area_data->ion_handle); + if(area_data->ion_handle != NULL) + ion_free(rk_fb->ion_client, area_data->ion_handle); } } memset(reg_win_data, 0, sizeof(struct rk_fb_reg_win_data)); @@ -1321,6 +1322,12 @@ static int rk_fb_set_win_buffer(struct fb_info *info, } if(j == i){ hdl = ion_import_dma_buf(rk_fb->ion_client, ion_fd); + if (IS_ERR(hdl)) { + pr_info("%s: Could not import handle: %d\n", + __func__, (int)hdl); + /*return -EINVAL;*/ + break; + } reg_win_data->reg_area_data[i].ion_handle = hdl; #ifndef USE_ION_MMU ion_phys(rk_fb->ion_client, hdl, &phy_addr, &len);