audio/transport: Don't set volume if it's invalid
authorArchie Pusaka <apusaka@chromium.org>
Tue, 1 Sep 2020 04:00:00 +0000 (12:00 +0800)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:32 +0000 (19:08 +0530)
Adding a check inside media_transport_update_volume to prevent
the volume being updated with an invalid value.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
profiles/audio/transport.c

index bb5354c..04d8ea8 100644 (file)
@@ -1069,6 +1069,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;