forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 e636c8d336489bf3eed5878299e6cc045bbad077
kernel/drivers/video/fbdev/tgafb.c
....@@ -70,7 +70,7 @@
7070 * Frame buffer operations
7171 */
7272
73
-static struct fb_ops tgafb_ops = {
73
+static const struct fb_ops tgafb_ops = {
7474 .owner = THIS_MODULE,
7575 .fb_check_var = tgafb_check_var,
7676 .fb_set_par = tgafb_set_par,
....@@ -165,6 +165,9 @@
165165 tgafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
166166 {
167167 struct tga_par *par = (struct tga_par *)info->par;
168
+
169
+ if (!var->pixclock)
170
+ return -EINVAL;
168171
169172 if (par->tga_type == TGA_TYPE_8PLANE) {
170173 if (var->bits_per_pixel != 8)
....@@ -989,8 +992,10 @@
989992 /* We can fill 2k pixels per operation. Notice blocks that fit
990993 the width of the screen so that we can take advantage of this
991994 and fill more than one line per write. */
992
- if (width == line_length)
993
- width *= height, height = 1;
995
+ if (width == line_length) {
996
+ width *= height;
997
+ height = 1;
998
+ }
994999
9951000 /* The write into the frame buffer must be aligned to 4 bytes,
9961001 but we are allowed to encode the offset within the word in
....@@ -1171,8 +1176,10 @@
11711176 More than anything else, these control how we do copies. */
11721177 depos = dy * line_length + dx;
11731178 sepos = sy * line_length + sx;
1174
- if (backward)
1175
- depos += width, sepos += width;
1179
+ if (backward) {
1180
+ depos += width;
1181
+ sepos += width;
1182
+ }
11761183
11771184 /* Next copy full words at a time. */
11781185 n32 = width / 32;
....@@ -1416,10 +1423,8 @@
14161423
14171424 /* Allocate the fb and par structures. */
14181425 info = framebuffer_alloc(sizeof(struct tga_par), dev);
1419
- if (!info) {
1420
- printk(KERN_ERR "tgafb: Cannot allocate memory\n");
1426
+ if (!info)
14211427 return -ENOMEM;
1422
- }
14231428
14241429 par = info->par;
14251430 dev_set_drvdata(dev, info);
....@@ -1440,7 +1445,7 @@
14401445 }
14411446
14421447 /* Map the framebuffer. */
1443
- mem_base = ioremap_nocache(bar0_start, bar0_len);
1448
+ mem_base = ioremap(bar0_start, bar0_len);
14441449 if (!mem_base) {
14451450 printk(KERN_ERR "tgafb: Cannot map MMIO\n");
14461451 goto err1;