diff mbox series

[Bluez,v2] audio/transport: Don't set volume if it's invalid

Message ID 20200901115913.Bluez.v2.1.Ieeae14ab680eda03474551fdb7a0a020f950e9c1@changeid
State New
Headers show
Series [Bluez,v2] audio/transport: Don't set volume if it's invalid | expand

Commit Message

Archie Pusaka Sept. 1, 2020, 4 a.m. UTC
From: Archie Pusaka <apusaka@chromium.org>

Adding a check inside media_transport_update_volume to prevent
the volume being updated with an invalid value.
---

Changes in v2:
* Move the check from media.c:set_configuration

 profiles/audio/transport.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c
index a2c4f7dfb..dd1c553a2 100644
--- a/profiles/audio/transport.c
+++ b/profiles/audio/transport.c
@@ -941,6 +941,9 @@  void media_transport_update_volume(struct media_transport *transport,
 {
 	struct a2dp_transport *a2dp = transport->data;
 
+	if (volume < 0)
+		return;
+
 	/* Check if volume really changed */
 	if (a2dp->volume == volume)
 		return;