forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/video/fbdev/core/fbcvt.c
....@@ -214,9 +214,11 @@
214214 static void fb_cvt_print_name(struct fb_cvt_data *cvt)
215215 {
216216 u32 pixcount, pixcount_mod;
217
- int cnt = 255, offset = 0, read = 0;
218
- u8 *buf = kzalloc(256, GFP_KERNEL);
217
+ int size = 256;
218
+ int off = 0;
219
+ u8 *buf;
219220
221
+ buf = kzalloc(size, GFP_KERNEL);
220222 if (!buf)
221223 return;
222224
....@@ -224,43 +226,30 @@
224226 pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000;
225227 pixcount_mod /= 1000;
226228
227
- read = snprintf(buf+offset, cnt, "fbcvt: %dx%d@%d: CVT Name - ",
228
- cvt->xres, cvt->yres, cvt->refresh);
229
- offset += read;
230
- cnt -= read;
229
+ off += scnprintf(buf + off, size - off, "fbcvt: %dx%d@%d: CVT Name - ",
230
+ cvt->xres, cvt->yres, cvt->refresh);
231231
232
- if (cvt->status)
233
- snprintf(buf+offset, cnt, "Not a CVT standard - %d.%03d Mega "
234
- "Pixel Image\n", pixcount, pixcount_mod);
235
- else {
236
- if (pixcount) {
237
- read = snprintf(buf+offset, cnt, "%d", pixcount);
238
- cnt -= read;
239
- offset += read;
240
- }
232
+ if (cvt->status) {
233
+ off += scnprintf(buf + off, size - off,
234
+ "Not a CVT standard - %d.%03d Mega Pixel Image\n",
235
+ pixcount, pixcount_mod);
236
+ } else {
237
+ if (pixcount)
238
+ off += scnprintf(buf + off, size - off, "%d", pixcount);
241239
242
- read = snprintf(buf+offset, cnt, ".%03dM", pixcount_mod);
243
- cnt -= read;
244
- offset += read;
240
+ off += scnprintf(buf + off, size - off, ".%03dM", pixcount_mod);
245241
246242 if (cvt->aspect_ratio == 0)
247
- read = snprintf(buf+offset, cnt, "3");
243
+ off += scnprintf(buf + off, size - off, "3");
248244 else if (cvt->aspect_ratio == 3)
249
- read = snprintf(buf+offset, cnt, "4");
245
+ off += scnprintf(buf + off, size - off, "4");
250246 else if (cvt->aspect_ratio == 1 || cvt->aspect_ratio == 4)
251
- read = snprintf(buf+offset, cnt, "9");
247
+ off += scnprintf(buf + off, size - off, "9");
252248 else if (cvt->aspect_ratio == 2)
253
- read = snprintf(buf+offset, cnt, "A");
254
- else
255
- read = 0;
256
- cnt -= read;
257
- offset += read;
249
+ off += scnprintf(buf + off, size - off, "A");
258250
259
- if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK) {
260
- read = snprintf(buf+offset, cnt, "-R");
261
- cnt -= read;
262
- offset += read;
263
- }
251
+ if (cvt->flags & FB_CVT_FLAG_REDUCED_BLANK)
252
+ off += scnprintf(buf + off, size - off, "-R");
264253 }
265254
266255 printk(KERN_INFO "%s\n", buf);