Skip to content

Instantly share code, notes, and snippets.

@adrientetar
Created May 6, 2013 20:27
Show Gist options
  • Select an option

  • Save adrientetar/5527918 to your computer and use it in GitHub Desktop.

Select an option

Save adrientetar/5527918 to your computer and use it in GitHub Desktop.
2.6.32 -> 3.0.8
--- /home/adrien/logo.c
+++ /home/adrien/msm7x30-3.0.x-nAa/drivers/video/msm/logo.c
@@ -46,13 +46,12 @@
}
/* 565RLE image format: [count(2 bytes), rle(2 bytes)] */
-int load_565rle_image(char *filename)
+int load_565rle_image(char *filename, bool bf_supported)
{
struct fb_info *info;
- int fd, err = 0;
- unsigned count, max;
- unsigned short *data, *ptr;
- unsigned char *bits;
+ int fd, count, err = 0;
+ unsigned max;
+ unsigned short *data, *bits, *ptr;
info = registered_fb[0];
if (!info) {
@@ -67,8 +66,8 @@
__func__, filename);
return -ENOENT;
}
- count = (unsigned)sys_lseek(fd, (off_t)0, 2);
- if (count == 0) {
+ count = sys_lseek(fd, (off_t)0, 2);
+ if (count <= 0) {
sys_close(fd);
err = -EIO;
goto err_logo_close_file;
@@ -80,14 +79,20 @@
err = -ENOMEM;
goto err_logo_close_file;
}
- if ((unsigned)sys_read(fd, (char *)data, count) != count) {
+ if (sys_read(fd, (char *)data, count) != count) {
err = -EIO;
goto err_logo_free_data;
}
max = fb_width(info) * fb_height(info);
ptr = data;
- bits = (unsigned char *)(info->screen_base);
+ if (bf_supported && (info->node == 1 || info->node == 2)) {
+ err = -EPERM;
+ pr_err("%s:%d no info->creen_base on fb%d!\n",
+ __func__, __LINE__, info->node);
+ goto err_logo_free_data;
+ }
+ bits = (unsigned short *)(info->screen_base);
while (count > 3) {
unsigned int n = ptr[0];
if (n > max)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment