diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-05-28 00:24:45 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-05-28 00:24:45 +0000 |
commit | a8c7bfd6c6b7cc3d54a8a57d50c9e44f92a0a91c (patch) | |
tree | 5c5449588d9b4723396e056b312ed0a41cba7aaa /sys/dev | |
parent | 23e76ff42a82514d070bdcf50131075e1c19166a (diff) |
avoid uninitialised var use when scsi_get_link() returns NULL
found by smatch, ok krw@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/nvme.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/ic/nvme.c b/sys/dev/ic/nvme.c index fd31bcf2a11..10688918698 100644 --- a/sys/dev/ic/nvme.c +++ b/sys/dev/ic/nvme.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nvme.c,v 1.114 2024/05/27 14:46:26 krw Exp $ */ +/* $OpenBSD: nvme.c,v 1.115 2024/05/28 00:24:44 jsg Exp $ */ /* * Copyright (c) 2014 David Gwynne <dlg@openbsd.org> @@ -1897,12 +1897,12 @@ nvme_bioctl_sdname(const struct nvme_softc *sc, int target) const struct sd_softc *sd; link = scsi_get_link(sc->sc_scsibus, target, 0); - if (link) { - sd = (struct sd_softc *)(link->device_softc); - if (ISSET(link->state, SDEV_S_DYING) || sd == NULL || - ISSET(sd->flags, SDF_DYING)) - return NULL; - } + if (link == NULL) + return NULL; + sd = (struct sd_softc *)(link->device_softc); + if (ISSET(link->state, SDEV_S_DYING) || sd == NULL || + ISSET(sd->flags, SDF_DYING)) + return NULL; if (nvme_read4(sc, NVME_VS) == 0xffffffff) return NULL; |