git: 80b42329248a - main - nvme: Fix panic on detach after ce75bfcac9cfe
Date: Fri, 14 Jun 2024 19:33:40 UTC
The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=80b42329248a7473f79eebf7850ee8e4116c17dd commit 80b42329248a7473f79eebf7850ee8e4116c17dd Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2024-06-14 19:32:10 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2024-06-14 19:32:10 +0000 nvme: Fix panic on detach after ce75bfcac9cfe MFC after: 2 weeks --- sys/dev/nvme/nvme_ns.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/dev/nvme/nvme_ns.c b/sys/dev/nvme/nvme_ns.c index b19fc8664407..4c65e2c49e64 100644 --- a/sys/dev/nvme/nvme_ns.c +++ b/sys/dev/nvme/nvme_ns.c @@ -620,8 +620,9 @@ void nvme_ns_destruct(struct nvme_namespace *ns) { - if (ns->cdev->si_drv2 != NULL) - destroy_dev(ns->cdev->si_drv2); - if (ns->cdev != NULL) + if (ns->cdev != NULL) { + if (ns->cdev->si_drv2 != NULL) + destroy_dev(ns->cdev->si_drv2); destroy_dev(ns->cdev); + } }