git: a19d42b08a40 - stable/14 - sound: Remove ncards variable from sound_oss_card_info()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Fri, 17 May 2024 19:31:20 UTC
The branch stable/14 has been updated by christos:

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

commit a19d42b08a40cda6af119f14236e166e178bd2cd
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-05-14 13:42:20 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-05-17 19:30:36 +0000

    sound: Remove ncards variable from sound_oss_card_info()
    
    The loop counter is also the card's index, so ncards is redundant.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    dev_submerge.ch
    Differential Revision:  https://reviews.freebsd.org/D45144
    
    (cherry picked from commit 305db91d4b92a5d53826dcb6df39fc8a1f3b427e)
---
 sys/dev/sound/pcm/sound.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c
index 3e95fd0e0ea4..e66462af2a71 100644
--- a/sys/dev/sound/pcm/sound.c
+++ b/sys/dev/sound/pcm/sound.c
@@ -792,9 +792,7 @@ int
 sound_oss_card_info(oss_card_info *si)
 {
 	struct snddev_info *d;
-	int i, ncards;
-
-	ncards = 0;
+	int i;
 
 	for (i = 0; pcm_devclass != NULL &&
 	    i < devclass_get_maxunit(pcm_devclass); i++) {
@@ -802,7 +800,7 @@ sound_oss_card_info(oss_card_info *si)
 		if (!PCM_REGISTERED(d))
 			continue;
 
-		if (ncards++ != si->card)
+		if (i != si->card)
 			continue;
 
 		PCM_UNLOCKASSERT(d);