psm: properly check for atkbdc_open failure

atkbdc_open can return NULL if the unit's out of bounds or the softc isn't
setup. Check it to be safe.
This commit is contained in:
Kyle Evans 2019-12-31 13:56:48 +00:00
parent 7d87664a04
commit 6d3c9beedb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356225

View File

@ -1390,6 +1390,8 @@ psmprobe(device_t dev)
sc->unit = unit;
sc->kbdc = atkbdc_open(device_get_unit(device_get_parent(dev)));
if (sc->kbdc == NULL)
return (ENXIO);
sc->config = device_get_flags(dev) & PSM_CONFIG_FLAGS;
/* XXX: for backward compatibility */
#if defined(PSM_HOOKRESUME) || defined(PSM_HOOKAPM)