Lines 317-328
static void uvesafb_setup_var(struct fb_var_screeninfo *var,
Link Here
|
317 |
static int uvesafb_vbe_find_mode(struct uvesafb_par *par, |
317 |
static int uvesafb_vbe_find_mode(struct uvesafb_par *par, |
318 |
int xres, int yres, int depth, unsigned char flags) |
318 |
int xres, int yres, int depth, unsigned char flags) |
319 |
{ |
319 |
{ |
320 |
int i, match = -1, h = 0, d = 0x7fffffff; |
320 |
int i, match = -1; |
|
|
321 |
unsigned int h = 0, d = UINT_MAX; |
321 |
|
322 |
|
322 |
for (i = 0; i < par->vbe_modes_cnt; i++) { |
323 |
for (i = 0; i < par->vbe_modes_cnt; i++) { |
323 |
h = abs(par->vbe_modes[i].x_res - xres) + |
324 |
h = abs((signed)(par->vbe_modes[i].x_res - xres)) + |
324 |
abs(par->vbe_modes[i].y_res - yres) + |
325 |
abs((signed)(par->vbe_modes[i].y_res - yres)) + |
325 |
abs(depth - par->vbe_modes[i].depth); |
326 |
abs((signed)(depth - par->vbe_modes[i].depth)); |
326 |
|
327 |
|
327 |
/* |
328 |
/* |
328 |
* We have an exact match in terms of resolution |
329 |
* We have an exact match in terms of resolution |
Lines 1375-1381
static int uvesafb_check_var(struct fb_var_screeninfo *var,
Link Here
|
1375 |
* which is theoretically incorrect, but which we'll try to handle |
1376 |
* which is theoretically incorrect, but which we'll try to handle |
1376 |
* here. |
1377 |
* here. |
1377 |
*/ |
1378 |
*/ |
1378 |
if (depth == 0 || abs(depth - var->bits_per_pixel) >= 8) |
1379 |
if (depth == 0 || abs((signed)(depth - var->bits_per_pixel)) >= 8) |
1379 |
depth = var->bits_per_pixel; |
1380 |
depth = var->bits_per_pixel; |
1380 |
|
1381 |
|
1381 |
match = uvesafb_vbe_find_mode(par, var->xres, var->yres, depth, |
1382 |
match = uvesafb_vbe_find_mode(par, var->xres, var->yres, depth, |