.. | .. |
---|
214 | 214 | static void fb_cvt_print_name(struct fb_cvt_data *cvt) |
---|
215 | 215 | { |
---|
216 | 216 | 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; |
---|
219 | 220 | |
---|
| 221 | + buf = kzalloc(size, GFP_KERNEL); |
---|
220 | 222 | if (!buf) |
---|
221 | 223 | return; |
---|
222 | 224 | |
---|
.. | .. |
---|
224 | 226 | pixcount_mod = (cvt->xres * (cvt->yres/cvt->interlace)) % 1000000; |
---|
225 | 227 | pixcount_mod /= 1000; |
---|
226 | 228 | |
---|
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); |
---|
231 | 231 | |
---|
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); |
---|
241 | 239 | |
---|
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); |
---|
245 | 241 | |
---|
246 | 242 | if (cvt->aspect_ratio == 0) |
---|
247 | | - read = snprintf(buf+offset, cnt, "3"); |
---|
| 243 | + off += scnprintf(buf + off, size - off, "3"); |
---|
248 | 244 | else if (cvt->aspect_ratio == 3) |
---|
249 | | - read = snprintf(buf+offset, cnt, "4"); |
---|
| 245 | + off += scnprintf(buf + off, size - off, "4"); |
---|
250 | 246 | 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"); |
---|
252 | 248 | 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"); |
---|
258 | 250 | |
---|
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"); |
---|
264 | 253 | } |
---|
265 | 254 | |
---|
266 | 255 | printk(KERN_INFO "%s\n", buf); |
---|