The branch stable/14 has been updated by christos:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=9091f61d2f2c947a29b4f7709232070e90f5cec2

commit 9091f61d2f2c947a29b4f7709232070e90f5cec2
Author:     Christos Margiolis <chris...@freebsd.org>
AuthorDate: 2025-02-25 11:44:05 +0000
Commit:     Christos Margiolis <chris...@freebsd.org>
CommitDate: 2025-03-04 15:46:06 +0000

    sound: Get rid of redundant variables in chn_setspeed() and chn_setformat()
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Reviewed by:    dev_submerge.ch, emaste
    Differential Revision:  https://reviews.freebsd.org/D48011
    
    (cherry picked from commit 4e1b75bebf41b6e446d72c755fa420836341ade2)
---
 sys/dev/sound/pcm/channel.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c
index 17c11dc33b7a..19b2db321cee 100644
--- a/sys/dev/sound/pcm/channel.c
+++ b/sys/dev/sound/pcm/channel.c
@@ -2104,21 +2104,20 @@ chn_setparam(struct pcm_channel *c, uint32_t format, 
uint32_t speed)
 int
 chn_setspeed(struct pcm_channel *c, uint32_t speed)
 {
-       uint32_t oldformat, oldspeed, format;
+       uint32_t oldformat, oldspeed;
        int ret;
 
        oldformat = c->format;
        oldspeed = c->speed;
-       format = oldformat;
 
-       ret = chn_setparam(c, format, speed);
+       ret = chn_setparam(c, c->format, speed);
        if (ret != 0) {
                if (snd_verbose > 3)
                        device_printf(c->dev,
                            "%s(): Setting speed %d failed, "
                            "falling back to %d\n",
                            __func__, speed, oldspeed);
-               chn_setparam(c, c->format, oldspeed);
+               chn_setparam(c, oldformat, oldspeed);
        }
 
        return (ret);
@@ -2127,7 +2126,7 @@ chn_setspeed(struct pcm_channel *c, uint32_t speed)
 int
 chn_setformat(struct pcm_channel *c, uint32_t format)
 {
-       uint32_t oldformat, oldspeed, speed;
+       uint32_t oldformat, oldspeed;
        int ret;
 
        /* XXX force stereo */
@@ -2138,9 +2137,8 @@ chn_setformat(struct pcm_channel *c, uint32_t format)
 
        oldformat = c->format;
        oldspeed = c->speed;
-       speed = oldspeed;
 
-       ret = chn_setparam(c, format, speed);
+       ret = chn_setparam(c, format, c->speed);
        if (ret != 0) {
                if (snd_verbose > 3)
                        device_printf(c->dev,

Reply via email to