mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-10 08:22:27 +01:00
Reduce code duplication.
Hopefully this clears up some confusion about the nature of devclass_get_softc() vs. device_get_softc() as well. The check against DS_ATTACHED remains as this is not a change that modifies functionality. Reviewed by: Peter "in principle" Wemm
This commit is contained in:
parent
98733bd871
commit
44a451ba24
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53938
@ -432,12 +432,14 @@ devclass_get_softc(devclass_t dc, int unit)
|
||||
{
|
||||
device_t dev;
|
||||
|
||||
if (unit < 0 || unit >= dc->maxunit)
|
||||
return NULL;
|
||||
dev = dc->devices[unit];
|
||||
if (!dev || dev->state < DS_ATTACHED)
|
||||
return NULL;
|
||||
return dev->softc;
|
||||
dev = devclass_get_device(dc, unit);
|
||||
if (!dev)
|
||||
return (NULL);
|
||||
|
||||
if (device_get_state(dev) < DS_ATTACHED)
|
||||
return (NULL);
|
||||
|
||||
return (device_get_softc(dev));
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user