Commit 314ce057 authored by Ladislav Michl's avatar Ladislav Michl Committed by Greg Kroah-Hartman

video: udlfb: Fix read EDID timeout


[ Upstream commit c9876947 ]

While usb_control_msg function expects timeout in miliseconds, a value
of HZ is used. Replace it with USB_CTRL_GET_TIMEOUT and also fix error
message which looks like:
udlfb: Read EDID byte 78 failed err ffffff92
as error is either negative errno or number of bytes transferred use %d
format specifier.

Returned EDID is in second byte, so return error when less than two bytes
are received.

Fixes: 18dffdf8 ("staging: udlfb: enhance EDID and mode handling support")
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Cc: Bernie Thompson <bernie@plugable.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f542745
...@@ -769,11 +769,11 @@ static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len) ...@@ -769,11 +769,11 @@ static int dlfb_get_edid(struct dlfb_data *dev, char *edid, int len)
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
ret = usb_control_msg(dev->udev, ret = usb_control_msg(dev->udev,
usb_rcvctrlpipe(dev->udev, 0), (0x02), usb_rcvctrlpipe(dev->udev, 0), 0x02,
(0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, (0x80 | (0x02 << 5)), i << 8, 0xA1,
HZ); rbuf, 2, USB_CTRL_GET_TIMEOUT);
if (ret < 1) { if (ret < 2) {
pr_err("Read EDID byte %d failed err %x\n", i, ret); pr_err("Read EDID byte %d failed: %d\n", i, ret);
i--; i--;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment