mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 21:46:44 +07:00
[media] em28xx: don't treat device as webcam if an unknown sensor is detected
With an unknown sensor, norm_maxw() and norm_maxh() return 0 as max. height and width values, which causes a devide by zero in size_to_scale(). Of course we could use speculative default values for unknown sensors, but the chance that the device works at this resolution without any driver/setup is very low and therefore not worth the efforts. Instead, just don't treat the device as camera. A message will then be printed to the log that the device isn't supported. Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
parent
bb42fc4ad4
commit
85316cf8da
@ -2919,7 +2919,9 @@ static void em28xx_card_setup(struct em28xx *dev)
|
||||
* If sensor is not found, then it isn't a webcam.
|
||||
*/
|
||||
if (dev->board.is_webcam) {
|
||||
if (em28xx_detect_sensor(dev) < 0)
|
||||
em28xx_detect_sensor(dev);
|
||||
if (dev->em28xx_sensor == EM28XX_NOSENSOR)
|
||||
/* NOTE: error/unknown sensor/no sensor */
|
||||
dev->board.is_webcam = 0;
|
||||
}
|
||||
|
||||
@ -3667,9 +3669,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
|
||||
try_bulk = usb_xfer_mode > 0;
|
||||
}
|
||||
|
||||
/* Disable V4L2 if the device doesn't have a decoder */
|
||||
/* Disable V4L2 if the device doesn't have a decoder or image sensor */
|
||||
if (has_video &&
|
||||
dev->board.decoder == EM28XX_NODECODER && !dev->board.is_webcam) {
|
||||
dev->board.decoder == EM28XX_NODECODER &&
|
||||
dev->em28xx_sensor == EM28XX_NOSENSOR) {
|
||||
|
||||
dev_err(&interface->dev,
|
||||
"Currently, V4L2 is not supported on this model\n");
|
||||
has_video = false;
|
||||
|
Loading…
Reference in New Issue
Block a user