CVS commit: [netbsd-9] src/sys/dev/hdaudio

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:24:38 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdafg.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1795):

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/hdaudio/hdafg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.18.2.1 src/sys/dev/hdaudio/hdafg.c:1.18.2.2
--- src/sys/dev/hdaudio/hdafg.c:1.18.2.1	Sat Apr 25 10:40:45 2020
+++ src/sys/dev/hdaudio/hdafg.c	Sat Feb  3 14:24:38 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.18.2.1 2020/04/25 10:40:45 martin Exp $ */
+/* $NetBSD: hdafg.c,v 1.18.2.2 2024/02/03 14:24:38 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18.2.1 2020/04/25 10:40:45 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.18.2.2 2024/02/03 14:24:38 martin Exp $");
 
 #include 
 #include 
@@ -4223,9 +4223,12 @@ hdafg_freem(void *opaque, void *addr, si
 	struct hdaudio_audiodev *ad = opaque;
 	struct hdaudio_stream *st;
 
-	if (addr == DMA_KERNADDR(>ad_playback->st_data))
+	if (ad == NULL)
+		return;
+
+	if (ad->ad_playback != NULL && addr == DMA_KERNADDR(>ad_playback->st_data))
 		st = ad->ad_playback;
-	else if (addr == DMA_KERNADDR(>ad_capture->st_data))
+	else if (ad->ad_capture != NULL && addr == DMA_KERNADDR(>ad_capture->st_data))
 		st = ad->ad_capture;
 	else
 		return;



CVS commit: [netbsd-9] src/sys/dev/hdaudio

2024-02-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Feb  3 14:24:38 UTC 2024

Modified Files:
src/sys/dev/hdaudio [netbsd-9]: hdafg.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1795):

sys/dev/hdaudio/hdafg.c: revision 1.29

ignore NULL for hdaudio_audiodev in hdafg_freem

also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.1 -r1.18.2.2 src/sys/dev/hdaudio/hdafg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.