mirror of
https://github.com/opnsense/src.git
synced 2026-07-13 19:20:56 -04:00
fb: Explicitly handle errors when getting or setting a colour palette
In the VESA driver, simply ignore errors. It is not clear to me how to
return them to userspace.
This is in preparation for annotating copyin() and related functions
with __result_use_check.
MFC after: 1 week
(cherry picked from commit ddc8576d29)
This commit is contained in:
parent
0328de3def
commit
3e53fec002
2 changed files with 23 additions and 15 deletions
|
|
@ -1698,12 +1698,12 @@ get_palette(video_adapter_t *adp, int base, int count,
|
|||
b = g + count;
|
||||
error = vesa_bios_save_palette2(base, count, r, g, b, bits);
|
||||
if (error == 0) {
|
||||
copyout(r, red, count);
|
||||
copyout(g, green, count);
|
||||
copyout(b, blue, count);
|
||||
(void)copyout(r, red, count);
|
||||
(void)copyout(g, green, count);
|
||||
(void)copyout(b, blue, count);
|
||||
if (trans != NULL) {
|
||||
bzero(r, count);
|
||||
copyout(r, trans, count);
|
||||
(void)copyout(r, trans, count);
|
||||
}
|
||||
}
|
||||
free(r, M_DEVBUF);
|
||||
|
|
@ -1729,12 +1729,12 @@ set_palette(video_adapter_t *adp, int base, int count,
|
|||
return (1);
|
||||
|
||||
bits = (adp->va_flags & V_ADP_DAC8) != 0 ? 8 : 6;
|
||||
r = malloc(count * 3, M_DEVBUF, M_WAITOK);
|
||||
r = malloc(count * 3, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
g = r + count;
|
||||
b = g + count;
|
||||
copyin(red, r, count);
|
||||
copyin(green, g, count);
|
||||
copyin(blue, b, count);
|
||||
(void)copyin(red, r, count);
|
||||
(void)copyin(green, g, count);
|
||||
(void)copyin(blue, b, count);
|
||||
|
||||
error = vesa_bios_load_palette2(base, count, r, g, b, bits);
|
||||
free(r, M_DEVBUF);
|
||||
|
|
|
|||
|
|
@ -2854,6 +2854,7 @@ get_palette(video_adapter_t *adp, int base, int count,
|
|||
u_char *r;
|
||||
u_char *g;
|
||||
u_char *b;
|
||||
int error;
|
||||
|
||||
if (count < 0 || base < 0 || count > 256 || base > 256 ||
|
||||
base + count > 256)
|
||||
|
|
@ -2863,19 +2864,26 @@ get_palette(video_adapter_t *adp, int base, int count,
|
|||
g = r + count;
|
||||
b = g + count;
|
||||
if (vga_save_palette2(adp, base, count, r, g, b)) {
|
||||
free(r, M_DEVBUF);
|
||||
return ENODEV;
|
||||
error = ENODEV;
|
||||
goto out;
|
||||
}
|
||||
copyout(r, red, count);
|
||||
copyout(g, green, count);
|
||||
copyout(b, blue, count);
|
||||
error = copyout(r, red, count);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
error = copyout(g, green, count);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
error = copyout(b, blue, count);
|
||||
if (error != 0)
|
||||
goto out;
|
||||
if (trans != NULL) {
|
||||
bzero(r, count);
|
||||
copyout(r, trans, count);
|
||||
error = copyout(r, trans, count);
|
||||
}
|
||||
out:
|
||||
free(r, M_DEVBUF);
|
||||
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Reference in a new issue