1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

[GIT PULL for v6.14] media updates

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+QmuaPwR3wnBdVwACF8+vY7k4RUFAmedPSUACgkQCF8+vY7k
 4RW1aA/8CkL1ccEx41q1bWSL7PYL8Z0UNgqoiAj2H9jdHOvHIAxdgYUFuW03ZlBa
 h8zDuMnlS5+Dn8dM5c87ykDJnyVzc06mKGJl9f4qcmwMbj3bUI9k6uDyCErONZKN
 CyAk+KFjuNPjWMRZhmtbzhyHjPPm11gazoV6tfox0rqSyFDOYDtLLn1sdhCFfs3Y
 gguLag/N7PB7IeYDZnG4TQa8T71hcDQJdEnXPPQMZrtjtYFQLzzkZADJOziWFx3U
 RjgfhiDE2iZ5gpQm7Duk6daZAiqoXJlraGkwE4a96OkSb/t8k1G05qPSEzjeE/j6
 nnwMYxefUbPcir2g4aQr02GknDY4icgDeZqYIdiNhnYxDQsfnLOTcvFQqfa0BFpE
 N8LazRRsHz+8p1+OoOUskdKeo36olg4sB4OO6dKS8d44IGleEpNEElj2s3f64OOn
 ptFpc4HtDBF6GwLorHyDDMf1w+batM30DSTNNkjg6uBv7u5Fdc476nje3fQwEo1R
 ye9u5xvi9CHkeF0kRpMBvXsHEIxSceH9vKF0OcIi9DShyDwqxAwld63/8ENo3nm9
 3TS83RgGLKpQcihfk7TovfTlwhLUqIlGmcf2aEC4d+NTnSw4if4h6yBnAi1RNpn/
 xeVNIpS4X9RIkb83R228vjdwj8YR+OBkpXO5tOrZsYm3UkTyqcY=
 =49gN
 -----END PGP SIGNATURE-----

Merge tag 'media/v6.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fix from Mauro Carvalho Chehab:
 "A revert for a regression in the uvcvideo driver"

* tag 'media/v6.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  Revert "media: uvcvideo: Require entities to have a non-zero unique ID"
This commit is contained in:
Linus Torvalds 2025-02-01 09:15:01 -08:00
commit c6fe03a3f9

View file

@ -790,27 +790,14 @@ static const u8 uvc_media_transport_input_guid[16] =
UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT;
static const u8 uvc_processing_guid[16] = UVC_GUID_UVC_PROCESSING;
static struct uvc_entity *uvc_alloc_new_entity(struct uvc_device *dev, u16 type,
u16 id, unsigned int num_pads,
unsigned int extra_size)
static struct uvc_entity *uvc_alloc_entity(u16 type, u16 id,
unsigned int num_pads, unsigned int extra_size)
{
struct uvc_entity *entity;
unsigned int num_inputs;
unsigned int size;
unsigned int i;
/* Per UVC 1.1+ spec 3.7.2, the ID should be non-zero. */
if (id == 0) {
dev_err(&dev->udev->dev, "Found Unit with invalid ID 0.\n");
return ERR_PTR(-EINVAL);
}
/* Per UVC 1.1+ spec 3.7.2, the ID is unique. */
if (uvc_entity_by_id(dev, id)) {
dev_err(&dev->udev->dev, "Found multiple Units with ID %u\n", id);
return ERR_PTR(-EINVAL);
}
extra_size = roundup(extra_size, sizeof(*entity->pads));
if (num_pads)
num_inputs = type & UVC_TERM_OUTPUT ? num_pads : num_pads - 1;
@ -820,7 +807,7 @@ static struct uvc_entity *uvc_alloc_new_entity(struct uvc_device *dev, u16 type,
+ num_inputs;
entity = kzalloc(size, GFP_KERNEL);
if (entity == NULL)
return ERR_PTR(-ENOMEM);
return NULL;
entity->id = id;
entity->type = type;
@ -932,10 +919,10 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
break;
}
unit = uvc_alloc_new_entity(dev, UVC_VC_EXTENSION_UNIT,
buffer[3], p + 1, 2 * n);
if (IS_ERR(unit))
return PTR_ERR(unit);
unit = uvc_alloc_entity(UVC_VC_EXTENSION_UNIT, buffer[3],
p + 1, 2*n);
if (unit == NULL)
return -ENOMEM;
memcpy(unit->guid, &buffer[4], 16);
unit->extension.bNumControls = buffer[20];
@ -1044,10 +1031,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return -EINVAL;
}
term = uvc_alloc_new_entity(dev, type | UVC_TERM_INPUT,
buffer[3], 1, n + p);
if (IS_ERR(term))
return PTR_ERR(term);
term = uvc_alloc_entity(type | UVC_TERM_INPUT, buffer[3],
1, n + p);
if (term == NULL)
return -ENOMEM;
if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA) {
term->camera.bControlSize = n;
@ -1103,10 +1090,10 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return 0;
}
term = uvc_alloc_new_entity(dev, type | UVC_TERM_OUTPUT,
buffer[3], 1, 0);
if (IS_ERR(term))
return PTR_ERR(term);
term = uvc_alloc_entity(type | UVC_TERM_OUTPUT, buffer[3],
1, 0);
if (term == NULL)
return -ENOMEM;
memcpy(term->baSourceID, &buffer[7], 1);
@ -1125,10 +1112,9 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return -EINVAL;
}
unit = uvc_alloc_new_entity(dev, buffer[2], buffer[3],
p + 1, 0);
if (IS_ERR(unit))
return PTR_ERR(unit);
unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, 0);
if (unit == NULL)
return -ENOMEM;
memcpy(unit->baSourceID, &buffer[5], p);
@ -1148,9 +1134,9 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return -EINVAL;
}
unit = uvc_alloc_new_entity(dev, buffer[2], buffer[3], 2, n);
if (IS_ERR(unit))
return PTR_ERR(unit);
unit = uvc_alloc_entity(buffer[2], buffer[3], 2, n);
if (unit == NULL)
return -ENOMEM;
memcpy(unit->baSourceID, &buffer[4], 1);
unit->processing.wMaxMultiplier =
@ -1177,10 +1163,9 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
return -EINVAL;
}
unit = uvc_alloc_new_entity(dev, buffer[2], buffer[3],
p + 1, n);
if (IS_ERR(unit))
return PTR_ERR(unit);
unit = uvc_alloc_entity(buffer[2], buffer[3], p + 1, n);
if (unit == NULL)
return -ENOMEM;
memcpy(unit->guid, &buffer[4], 16);
unit->extension.bNumControls = buffer[20];
@ -1320,10 +1305,9 @@ static int uvc_gpio_parse(struct uvc_device *dev)
return dev_err_probe(&dev->intf->dev, irq,
"No IRQ for privacy GPIO\n");
unit = uvc_alloc_new_entity(dev, UVC_EXT_GPIO_UNIT,
UVC_EXT_GPIO_UNIT_ID, 0, 1);
if (IS_ERR(unit))
return PTR_ERR(unit);
unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1);
if (!unit)
return -ENOMEM;
unit->gpio.gpio_privacy = gpio_privacy;
unit->gpio.irq = irq;