The only remaining offender that used ti_chip() without checking for

compatibility first was the gpio code, so change that, and re-assert
that the TI chip is a known chip
This commit is contained in:
Olivier Houchard 2016-11-19 15:43:22 +00:00
parent 92fd9fe2b7
commit cbfebd9a6e
3 changed files with 6 additions and 4 deletions

View File

@ -65,8 +65,6 @@ static struct ofw_compat_data compat_data[] = {
static int
am335x_gpio_probe(device_t dev)
{
if (ti_chip() != CHIP_AM335X)
return (ENXIO);
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@ -74,6 +72,9 @@ am335x_gpio_probe(device_t dev)
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
if (ti_chip() != CHIP_AM335X)
return (ENXIO);
device_set_desc(dev, "TI AM335x General Purpose I/O (GPIO)");
return (0);

View File

@ -59,14 +59,14 @@ static struct ofw_compat_data compat_data[] = {
static int
omap4_gpio_probe(device_t dev)
{
if (ti_chip() != CHIP_OMAP_4)
return (ENXIO);
if (!ofw_bus_status_okay(dev))
return (ENXIO);
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0)
return (ENXIO);
if (ti_chip() != CHIP_OMAP_4)
return (ENXIO);
device_set_desc(dev, "TI OMAP4 General Purpose I/O (GPIO)");

View File

@ -74,6 +74,7 @@ extern int _ti_chip;
static __inline int ti_chip(void)
{
KASSERT(_ti_chip != -1, ("Can't determine TI Chip"));
return _ti_chip;
}