From: stsp Date: Thu, 8 Feb 2024 11:13:01 +0000 (+0000) Subject: fix uninitialized return from qwx_qmi_load_file_target_mem() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=09a11c37ed7663175b60f83bf1461ff1e62acdd5;p=openbsd fix uninitialized return from qwx_qmi_load_file_target_mem() Fortunately this case could only be reached with an empty firmware file. Found by jsg@ --- diff --git a/sys/dev/ic/qwx.c b/sys/dev/ic/qwx.c index b20a2fd3e16..6d4527720cf 100644 --- a/sys/dev/ic/qwx.c +++ b/sys/dev/ic/qwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qwx.c,v 1.20 2024/02/08 11:09:53 stsp Exp $ */ +/* $OpenBSD: qwx.c,v 1.21 2024/02/08 11:13:01 stsp Exp $ */ /* * Copyright 2023 Stefan Sperling @@ -8249,7 +8249,7 @@ qwx_qmi_load_file_target_mem(struct qwx_softc *sc, const u_char *data, #ifdef notyet void *bdf_addr = NULL; #endif - int ret; + int ret = EINVAL; /* empty fw image */ uint32_t remaining = len; req = malloc(sizeof(*req), M_DEVBUF, M_NOWAIT | M_ZERO); @@ -8393,7 +8393,7 @@ qwx_qmi_load_bdf_qmi(struct qwx_softc *sc, int regdb) fw_size = MIN(sc->hw_params.fw.board_size, boardfw_len); ret = qwx_qmi_load_file_target_mem(sc, boardfw, fw_size, bdf_type); - if (ret < 0) { + if (ret) { printf("%s: failed to load bdf file\n", __func__); goto out; }