summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorFrank Schaefer <fschaefer.oss@googlemail.com>2017-04-15 06:05:02 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-04-17 16:32:15 -0400
commit85316cf8da9e808f28c81343a050f489ac03e20e (patch)
treea1a52cae096ef81c82a4c9fb4e1e90a763748928 /drivers/media
parentbb42fc4ad442d4de78b4a16233db98a5396988ff (diff)
[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>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/usb/em28xx/em28xx-cards.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 6fb604900a33..a12b599a1fa2 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2919,7 +2919,9 @@ static void em28xx_card_setup(struct em28xx *dev)
2919 * If sensor is not found, then it isn't a webcam. 2919 * If sensor is not found, then it isn't a webcam.
2920 */ 2920 */
2921 if (dev->board.is_webcam) { 2921 if (dev->board.is_webcam) {
2922 if (em28xx_detect_sensor(dev) < 0) 2922 em28xx_detect_sensor(dev);
2923 if (dev->em28xx_sensor == EM28XX_NOSENSOR)
2924 /* NOTE: error/unknown sensor/no sensor */
2923 dev->board.is_webcam = 0; 2925 dev->board.is_webcam = 0;
2924 } 2926 }
2925 2927
@@ -3667,9 +3669,11 @@ static int em28xx_usb_probe(struct usb_interface *interface,
3667 try_bulk = usb_xfer_mode > 0; 3669 try_bulk = usb_xfer_mode > 0;
3668 } 3670 }
3669 3671
3670 /* Disable V4L2 if the device doesn't have a decoder */ 3672 /* Disable V4L2 if the device doesn't have a decoder or image sensor */
3671 if (has_video && 3673 if (has_video &&
3672 dev->board.decoder == EM28XX_NODECODER && !dev->board.is_webcam) { 3674 dev->board.decoder == EM28XX_NODECODER &&
3675 dev->em28xx_sensor == EM28XX_NOSENSOR) {
3676
3673 dev_err(&interface->dev, 3677 dev_err(&interface->dev,
3674 "Currently, V4L2 is not supported on this model\n"); 3678 "Currently, V4L2 is not supported on this model\n");
3675 has_video = false; 3679 has_video = false;