diff options
Diffstat (limited to 'drivers/media/media-entity.c')
-rw-r--r-- | drivers/media/media-entity.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 23640ed44d85..056138f63c7d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c | |||
@@ -378,7 +378,6 @@ EXPORT_SYMBOL_GPL(media_entity_create_link); | |||
378 | 378 | ||
379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | 379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) |
380 | { | 380 | { |
381 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
382 | int ret; | 381 | int ret; |
383 | 382 | ||
384 | /* Notify both entities. */ | 383 | /* Notify both entities. */ |
@@ -395,7 +394,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
395 | return ret; | 394 | return ret; |
396 | } | 395 | } |
397 | 396 | ||
398 | link->flags = (link->flags & ~mask) | (flags & mask); | 397 | link->flags = flags; |
399 | link->reverse->flags = link->flags; | 398 | link->reverse->flags = link->flags; |
400 | 399 | ||
401 | return 0; | 400 | return 0; |
@@ -417,6 +416,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
417 | */ | 416 | */ |
418 | int __media_entity_setup_link(struct media_link *link, u32 flags) | 417 | int __media_entity_setup_link(struct media_link *link, u32 flags) |
419 | { | 418 | { |
419 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
420 | struct media_device *mdev; | 420 | struct media_device *mdev; |
421 | struct media_entity *source, *sink; | 421 | struct media_entity *source, *sink; |
422 | int ret = -EBUSY; | 422 | int ret = -EBUSY; |
@@ -424,6 +424,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags) | |||
424 | if (link == NULL) | 424 | if (link == NULL) |
425 | return -EINVAL; | 425 | return -EINVAL; |
426 | 426 | ||
427 | /* The non-modifiable link flags must not be modified. */ | ||
428 | if ((link->flags & ~mask) != (flags & ~mask)) | ||
429 | return -EINVAL; | ||
430 | |||
427 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) | 431 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) |
428 | return link->flags == flags ? 0 : -EINVAL; | 432 | return link->flags == flags ? 0 : -EINVAL; |
429 | 433 | ||