When the entity being added has the default flag set, the function tries
to set the entity as the default entity for its type by storing the
entity pointer in the appropriate default entity field. If the entity
type isn't recognized, the default entity pointer is left uninitialized,
leading to a crash. Fix it.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
const struct media_entity_desc *desc,
const char *devnode)
{
- struct media_entity **defent;
+ struct media_entity **defent = NULL;
struct media_entity *entity;
unsigned int size;
if (desc->flags & MEDIA_ENT_FL_DEFAULT) {
entity->info.flags |= MEDIA_ENT_FL_DEFAULT;
- *defent = entity;
+ if (defent)
+ *defent = entity;
}
return 0;