hyperv/hn: Let the caller of hn_nvs_doinit() do the error logging.

So that NVS version probing failure does not look too scary.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7950
This commit is contained in:
Sepherosa Ziehau 2016-09-20 05:45:18 +00:00
parent a572f6042a
commit 5260781e82

View file

@ -444,8 +444,15 @@ hn_nvs_doinit(struct hn_softc *sc, uint32_t nvs_ver)
vmbus_xact_put(xact);
if (status != HN_NVS_STATUS_OK) {
if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n",
nvs_ver);
if (bootverbose) {
/*
* Caller may try another NVS version, and will log
* error if there are no more NVS versions to try,
* so don't bark out loud here.
*/
if_printf(sc->hn_ifp, "nvs init failed for ver 0x%x\n",
nvs_ver);
}
return (EINVAL);
}
return (0);
@ -499,7 +506,7 @@ hn_nvs_init_ndis(struct hn_softc *sc)
static int
hn_nvs_init(struct hn_softc *sc)
{
int i;
int i, error;
if (device_is_attached(sc->hn_dev)) {
/*
@ -511,15 +518,19 @@ hn_nvs_init(struct hn_softc *sc)
HN_NDIS_VERSION_MAJOR(sc->hn_ndis_ver),
HN_NDIS_VERSION_MINOR(sc->hn_ndis_ver));
}
return (hn_nvs_doinit(sc, sc->hn_nvs_ver));
error = hn_nvs_doinit(sc, sc->hn_nvs_ver);
if (error) {
if_printf(sc->hn_ifp, "reinit NVS version 0x%x "
"failed: %d\n", sc->hn_nvs_ver, error);
}
return (error);
}
/*
* Find the supported NVS version and set NDIS version accordingly.
*/
for (i = 0; i < nitems(hn_nvs_version); ++i) {
int error;
error = hn_nvs_doinit(sc, hn_nvs_version[i]);
if (!error) {
sc->hn_nvs_ver = hn_nvs_version[i];