git: 6f090333db2a - stable/14 - sound: Fix oss_audioinfo's card_number, port_number and legacy_device

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 19 Jun 2024 10:01:52 UTC
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=6f090333db2a9fe6d7f446145054eddd50ddc3fb

commit 6f090333db2a9fe6d7f446145054eddd50ddc3fb
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-06-18 13:19:07 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-06-19 10:01:33 +0000

    sound: Fix oss_audioinfo's card_number, port_number and legacy_device
    
    Although the docs advise against using them, it doesn't hurt to fill
    them out correctly.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 day
    Reviewed by:    dev_submerge.ch, markj
    Differential Revision:  https://reviews.freebsd.org/D45604
    
    (cherry picked from commit 0f878cdfc5a46cc0dc198e12758f12558dfb1bf6)
---
 sys/dev/sound/pcm/dsp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
index 0f6d7e6b7f49..f94e5c05a743 100644
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -2134,8 +2134,8 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai, bool ex)
 	strlcpy(ai->name, device_get_desc(d->dev), sizeof(ai->name));
 	ai->pid = -1;
 	strlcpy(ai->cmd, CHN_COMM_UNKNOWN, sizeof(ai->cmd));
-	ai->card_number = -1;
-	ai->port_number = -1;
+	ai->card_number = unit;
+	ai->port_number = unit;
 	ai->mixer_dev = (d->mixer_dev != NULL) ? unit : -1;
 	ai->legacy_device = unit;
 	snprintf(ai->devnode, sizeof(ai->devnode), "/dev/dsp%d", unit);
@@ -2371,20 +2371,20 @@ dsp_oss_engineinfo(struct cdev *i_dev, oss_audioinfo *ai)
 			 *    should normally not use this field for any
 			 *    purpose."
 			 */
-			ai->card_number = -1;
+			ai->card_number = unit;
 			/**
 			 * @todo @c song_name - depends first on
 			 *          SNDCTL_[GS]ETSONG @todo @c label - depends
 			 *          on SNDCTL_[GS]ETLABEL
 			 * @todo @c port_number - routing information?
 			 */
-			ai->port_number = -1;
+			ai->port_number = unit;
 			ai->mixer_dev = (d->mixer_dev != NULL) ? unit : -1;
 			/**
 			 * @note
 			 * @c legacy_device - OSSv4 docs:  "Obsolete."
 			 */
-			ai->legacy_device = -1;
+			ai->legacy_device = unit;
 			snprintf(ai->devnode, sizeof(ai->devnode), "/dev/dsp%d", unit);
 			ai->enabled = device_is_attached(d->dev) ? 1 : 0;
 			/**