for_each_child_of_node(root, child) {
pwr_ctr = kmalloc(sizeof(struct rk_disp_pwr_ctr_list),
GFP_KERNEL);
+ if (!pwr_ctr)
+ return -ENOMEM;
strcpy(pwr_ctr->pwr_ctr.name, child->name);
if (!of_property_read_u32(child, "rockchip,power_type", &val)) {
if (val == GPIO) {
fb_par->ion_hdl);
dev_drv->win[win_id]->area[0].ion_hdl =
fb_par->ion_hdl;
- if (dev_drv->iommu_enabled && dev_drv->mmu_dev)
+ if (dev_drv->mmu_dev)
ret = ion_map_iommu(dev_drv->dev,
rk_fb->ion_client,
fb_par->ion_hdl,
fbi = framebuffer_alloc(0, &fb_pdev->dev);
if (!fbi) {
dev_err(&fb_pdev->dev, "fb framebuffer_alloc fail!");
- ret = -ENOMEM;
+ return -ENOMEM;
}
fb_par = devm_kzalloc(&fb_pdev->dev, sizeof(struct rk_fb_par),
GFP_KERNEL);
nr_pages = size >> PAGE_SHIFT;
pages = kzalloc(sizeof(struct page) * nr_pages,
GFP_KERNEL);
+ if (!pages)
+ return -ENOMEM;
while (i < nr_pages) {
pages[i] = phys_to_page(start);
start += PAGE_SIZE;
pr_err("failed to vmap phy addr 0x%lx\n",
(long)(uboot_logo_base +
uboot_logo_offset));
+ kfree(pages);
return -1;
}
}
kfree(pages);
vunmap(vaddr);
- if (dev_drv->uboot_logo &&
- (width != xact || height != yact)) {
+ if (width != xact || height != yact) {
pr_err("can't support uboot kernel logo use different size [%dx%d] != [%dx%d]\n",
xact, yact, width, height);
return 0;
nr_pages = PAGE_ALIGN(logo_len + align) >> PAGE_SHIFT;
pages = kzalloc(sizeof(struct page) * nr_pages,
GFP_KERNEL);
+ if (!pages)
+ return -ENOMEM;
while (i < nr_pages) {
pages[i] = phys_to_page(start);
start += PAGE_SIZE;
if (!vaddr) {
pr_err("failed to vmap phy addr 0x%x\n",
start);
+ kfree(pages);
return -1;
}
nr_pages = roundup(width * height * (bits >> 3), PAGE_SIZE);
nr_pages /= PAGE_SIZE;
pages = kzalloc(sizeof(struct page) * nr_pages, GFP_KERNEL);
+ if (!pages)
+ return -ENOMEM;
while (i < nr_pages) {
pages[i] = phys_to_page(start);
start += PAGE_SIZE;
pr_info("dump win == > %s\n", name);
filp = filp_open(name, flags, 0x600);
if (!filp)
- printk("fail to create %s\n", name);
+ pr_err("fail to create %s\n", name);
old_fs = get_fs();
set_fs(KERNEL_DS);
}
static ssize_t show_dump_buffer(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
ssize_t size;
extern int __close_fd(struct files_struct *files, unsigned fd);
static ssize_t set_dsp_buffer(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+ struct device_attribute *attr,
+ const char *buf, size_t count)
{
struct fb_info *fbi = dev_get_drvdata(dev);
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;
const char *start = buf;
struct ion_handle *handle = NULL;
char __iomem *screen_base;
- struct rk_fb_win_cfg_data win_config;
+ struct rk_fb_win_cfg_data *win_config = NULL;
struct rk_screen *screen = dev_drv->cur_screen;
int space_max = 10;
int format;
}
screen_base = ion_map_kernel(rk_fb->ion_client, handle);
read_buffer(filp, screen_base, mem_size, 0);
+ win_config =
+ kzalloc(sizeof(*win_config), GFP_KERNEL);
+ if (!win_config)
+ return -ENOMEM;
- memset(&win_config, 0, sizeof(win_config));
- win_config.wait_fs = 0;
- win_config.win_par[0].win_id = 0;
- win_config.win_par[0].z_order = 0;
- win_config.win_par[0].area_par[0].data_format = format;
- win_config.win_par[0].area_par[0].ion_fd = fd;
- win_config.win_par[0].area_par[0].x_offset = 0;
- win_config.win_par[0].area_par[0].y_offset = 0;
- win_config.win_par[0].area_par[0].xpos = 0;
- win_config.win_par[0].area_par[0].ypos = 0;
- win_config.win_par[0].area_par[0].xsize = screen->mode.xres;
- win_config.win_par[0].area_par[0].ysize = screen->mode.yres;
- win_config.win_par[0].area_par[0].xact = width;
- win_config.win_par[0].area_par[0].yact = height;
- win_config.win_par[0].area_par[0].xvir = width;
- win_config.win_par[0].area_par[0].yvir = height;
+ memset(win_config, 0, sizeof(struct rk_fb_win_cfg_data));
+ win_config->wait_fs = 0;
+ win_config->win_par[0].win_id = 0;
+ win_config->win_par[0].z_order = 0;
+ win_config->win_par[0].area_par[0].data_format = format;
+ win_config->win_par[0].area_par[0].ion_fd = fd;
+ win_config->win_par[0].area_par[0].x_offset = 0;
+ win_config->win_par[0].area_par[0].y_offset = 0;
+ win_config->win_par[0].area_par[0].xpos = 0;
+ win_config->win_par[0].area_par[0].ypos = 0;
+ win_config->win_par[0].area_par[0].xsize = screen->mode.xres;
+ win_config->win_par[0].area_par[0].ysize = screen->mode.yres;
+ win_config->win_par[0].area_par[0].xact = width;
+ win_config->win_par[0].area_par[0].yact = height;
+ win_config->win_par[0].area_par[0].xvir = width;
+ win_config->win_par[0].area_par[0].yvir = height;
for (i = 0; i < frame_num; i++) {
- win_config.win_par[0].area_par[0].y_offset = height * i;
+ win_config->win_par[0].area_par[0].y_offset = height * i;
fbi->fbops->fb_ioctl(fbi, RK_FBIOSET_CONFIG_DONE,
- (unsigned long)(&win_config));
+ (unsigned long)(win_config));
for (j = 0; j < RK_MAX_BUF_NUM; j++) {
- if (win_config.rel_fence_fd[j] > 0) {
+ if (win_config->rel_fence_fd[j] > 0) {
acq_fence =
- sync_fence_fdget(win_config.rel_fence_fd[j]);
+ sync_fence_fdget(win_config->rel_fence_fd[j]);
sync_fence_put(acq_fence);
}
}
- if (win_config.ret_fence_fd > 0) {
+ if (win_config->ret_fence_fd > 0) {
acq_fence =
- sync_fence_fdget(win_config.ret_fence_fd);
+ sync_fence_fdget(win_config->ret_fence_fd);
sync_fence_put(acq_fence);
}
}
set_fs(old_fs);
filp_close(filp, NULL);
-
+ kfree(win_config);
return count;
}
static ssize_t set_hwc_lut(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- int hwc_lut[256];
+ int *hwc_lut = NULL;
const char *start = buf;
int i = 256, temp;
int space_max;
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;
struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv;
+ hwc_lut = kzalloc(256 * 4, GFP_KERNEL);
+ if (!hwc_lut)
+ return -ENOMEM;
/*printk("count:%d\n>>%s\n\n",count,start);*/
for (i = 0; i < 256; i++) {
space_max = 15; /*max space number 15*/
}
if (dev_drv->ops->set_hwc_lut)
dev_drv->ops->set_hwc_lut(dev_drv, hwc_lut, 1);
+ kfree(hwc_lut);
return count;
}
static ssize_t set_cabc_lut(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- int cabc_lut[256];
+ int *cabc_lut = NULL;
const char *start = buf;
int i = 256, temp;
int space_max = 10;
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;
struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv;
+ cabc_lut = kzalloc(256 * 4, GFP_KERNEL);
+ if (!cabc_lut)
+ return -ENOMEM;
for (i = 0; i < 256; i++) {
temp = i;
/*init by default value*/
if (dev_drv->ops->set_cabc_lut)
dev_drv->ops->set_cabc_lut(dev_drv, cabc_lut);
+ kfree(cabc_lut);
return count;
}
static ssize_t set_dsp_lut(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
- int dsp_lut[256];
+ int *dsp_lut = NULL;
const char *start = buf;
int i = 256, temp;
int space_max = 10;
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;
struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv;
+ dsp_lut = kzalloc(256 * 4, GFP_KERNEL);
+ if (!dsp_lut)
+ return -ENOMEM;
for (i = 0; i < 256; i++) {
temp = i;
/*init by default value*/
if (dev_drv->ops->set_dsp_lut)
dev_drv->ops->set_dsp_lut(dev_drv, dsp_lut);
+ kfree(dsp_lut);
return count;
}
struct fb_info *fbi = dev_get_drvdata(dev);
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;
struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv;
- int space_max, ret = 0, mode = 0, calc = 0, up = 0, down = 0, global = 0;
+ int space_max, ret = 0;
+ int mode = 0, calc = 0, up = 0, down = 0, global = 0;
const char *start = buf;
space_max = 10; /*max space number 10*/
start++;
global = simple_strtoul(start, NULL, 10);
- if (dev_drv->ops->set_dsp_cabc)
- ret = dev_drv->ops->set_dsp_cabc(dev_drv, mode, calc, up, down, global);
+ if (dev_drv->ops->set_dsp_cabc)
+ ret = dev_drv->ops->set_dsp_cabc(dev_drv, mode,
+ calc, up, down, global);
if (ret < 0)
return ret;
}
static ssize_t show_win_property(struct device *dev,
- struct device_attribute *attr,
- char *buf)
+ struct device_attribute *attr,
+ char *buf)
{
struct fb_info *fbi = dev_get_drvdata(dev);
struct rk_fb_par *fb_par = (struct rk_fb_par *)fbi->par;