From abf92e78e39956128d652ac229ba99e706293c0d Mon Sep 17 00:00:00 2001 From: Tim Crawford Date: Mon, 11 Jan 2021 12:34:42 -0700 Subject: [PATCH] Do not access NV device if not present Prevents NULL pointer dereference on pang10 when removing module. --- system76_nv_hda.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system76_nv_hda.c b/system76_nv_hda.c index 73a8c9f..7c2de34 100644 --- a/system76_nv_hda.c +++ b/system76_nv_hda.c @@ -162,6 +162,9 @@ static int __init nv_hda_init(struct device *dev) { } static void __exit nv_hda_exit(void) { + if (dis_dev == NULL) + return; + dis_dev_get(); nv_hda_off();