Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/hdaudio ignore NULL for hdaudio_audiodev in hdafg_freem



details:   https://anonhg.NetBSD.org/src/rev/a1430a2734bc
branches:  trunk
changeset: 372922:a1430a2734bc
user:      kardel <kardel%NetBSD.org@localhost>
date:      Thu Jan 05 09:57:39 2023 +0000

description:
ignore NULL for hdaudio_audiodev in hdafg_freem
also guard against NULL in ad_{capture,playback}
observed during shutdown on Lenovo W510

diffstat:

 sys/dev/hdaudio/hdafg.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 4abff784d694 -r a1430a2734bc sys/dev/hdaudio/hdafg.c
--- a/sys/dev/hdaudio/hdafg.c   Thu Jan 05 02:38:51 2023 +0000
+++ b/sys/dev/hdaudio/hdafg.c   Thu Jan 05 09:57:39 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.28 2022/05/24 06:28:00 andvar Exp $ */
+/* $NetBSD: hdafg.c,v 1.29 2023/01/05 09:57:39 kardel Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.28 2022/05/24 06:28:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.29 2023/01/05 09:57:39 kardel Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -4226,9 +4226,12 @@
        struct hdaudio_audiodev *ad = opaque;
        struct hdaudio_stream *st;
 
-       if (addr == DMA_KERNADDR(&ad->ad_playback->st_data))
+       if (ad == NULL)
+               return;
+
+       if (ad->ad_playback != NULL && addr == DMA_KERNADDR(&ad->ad_playback->st_data))
                st = ad->ad_playback;
-       else if (addr == DMA_KERNADDR(&ad->ad_capture->st_data))
+       else if (ad->ad_capture != NULL && addr == DMA_KERNADDR(&ad->ad_capture->st_data))
                st = ad->ad_capture;
        else
                return;



Home | Main Index | Thread Index | Old Index