Attention is currently required from: Felix Held. Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/58909 )
Change subject: superio: Replace bad uses of `find_resource` ......................................................................
superio: Replace bad uses of `find_resource`
The `find_resource` function will never return null (will die instead). In cases where the existing code already accounts for null pointers, it is better to use `probe_resource` instead, which returns a null pointer instead of dying.
Change-Id: Ic6e28add78f686fc9ab4556eddbedf7828fba9ef Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/superio/fintek/f71808a/f71808a_hwm.c M src/superio/fintek/f71869ad/f71869ad_hwm.c M src/superio/fintek/f81866d/f81866d_hwm.c M src/superio/fintek/f81866d/f81866d_uart.c M src/superio/ite/it8613e/superio.c M src/superio/ite/it8623e/superio.c M src/superio/ite/it8718f/superio.c M src/superio/ite/it8720f/superio.c M src/superio/ite/it8728f/superio.c M src/superio/ite/it8772f/superio.c M src/superio/ite/it8783ef/superio.c M src/superio/ite/it8786e/superio.c M src/superio/nuvoton/npcd378/superio.c 13 files changed, 14 insertions(+), 14 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/09/58909/1
diff --git a/src/superio/fintek/f71808a/f71808a_hwm.c b/src/superio/fintek/f71808a/f71808a_hwm.c index 340bc30..f8c4472 100644 --- a/src/superio/fintek/f71808a/f71808a_hwm.c +++ b/src/superio/fintek/f71808a/f71808a_hwm.c @@ -35,7 +35,7 @@
void f71808a_hwm_init(struct device *dev) { - struct resource *res = find_resource(dev, PNP_IDX_IO0); + struct resource *res = probe_resource(dev, PNP_IDX_IO0);
if (!res) { printk(BIOS_WARNING, "Super I/O HWM: No HWM resource found.\n"); diff --git a/src/superio/fintek/f71869ad/f71869ad_hwm.c b/src/superio/fintek/f71869ad/f71869ad_hwm.c index 6333ae1..9add2a7 100644 --- a/src/superio/fintek/f71869ad/f71869ad_hwm.c +++ b/src/superio/fintek/f71869ad/f71869ad_hwm.c @@ -41,7 +41,7 @@ void f71869ad_hwm_init(struct device *dev) { const struct superio_fintek_f71869ad_config *conf = dev->chip_info; - struct resource *res = find_resource(dev, PNP_IDX_IO0); + struct resource *res = probe_resource(dev, PNP_IDX_IO0);
if (!res) { printk(BIOS_WARNING, "Super I/O HWM: No HWM resource found.\n"); diff --git a/src/superio/fintek/f81866d/f81866d_hwm.c b/src/superio/fintek/f81866d/f81866d_hwm.c index a7ed96b..a82adb3 100644 --- a/src/superio/fintek/f81866d/f81866d_hwm.c +++ b/src/superio/fintek/f81866d/f81866d_hwm.c @@ -38,7 +38,7 @@
void f81866d_hwm_init(struct device *dev) { - struct resource *res = find_resource(dev, PNP_IDX_IO0); + struct resource *res = probe_resource(dev, PNP_IDX_IO0);
if (!res) { printk(BIOS_WARNING, "Super I/O HWM: No HWM resource found.\n"); diff --git a/src/superio/fintek/f81866d/f81866d_uart.c b/src/superio/fintek/f81866d/f81866d_uart.c index 7d98a7f..f6ebbfc 100644 --- a/src/superio/fintek/f81866d/f81866d_uart.c +++ b/src/superio/fintek/f81866d/f81866d_uart.c @@ -19,7 +19,7 @@ */ void f81866d_uart_init(struct device *dev) { - struct resource *res = find_resource(dev, PNP_IDX_IO0); + struct resource *res = probe_resource(dev, PNP_IDX_IO0); u8 tmp;
if (!res) { diff --git a/src/superio/ite/it8613e/superio.c b/src/superio/ite/it8613e/superio.c index 4d12457..c18c3ec 100644 --- a/src/superio/ite/it8613e/superio.c +++ b/src/superio/ite/it8613e/superio.c @@ -19,7 +19,7 @@
switch (dev->path.pnp.device) { case IT8613E_EC: - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8623e/superio.c b/src/superio/ite/it8623e/superio.c index ca3455a..15e0071 100644 --- a/src/superio/ite/it8623e/superio.c +++ b/src/superio/ite/it8623e/superio.c @@ -19,7 +19,7 @@
switch (dev->path.pnp.device) { case IT8623E_EC: - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8718f/superio.c b/src/superio/ite/it8718f/superio.c index aab554f..1243e75 100644 --- a/src/superio/ite/it8718f/superio.c +++ b/src/superio/ite/it8718f/superio.c @@ -24,7 +24,7 @@ break; case IT8718F_EC: conf = dev->chip_info; - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8720f/superio.c b/src/superio/ite/it8720f/superio.c index c63fa9a..75d0be9 100644 --- a/src/superio/ite/it8720f/superio.c +++ b/src/superio/ite/it8720f/superio.c @@ -51,7 +51,7 @@ switch (dev->path.pnp.device) { case IT8720F_EC: conf = dev->chip_info; - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8728f/superio.c b/src/superio/ite/it8728f/superio.c index 22e6ecb..67ef218 100644 --- a/src/superio/ite/it8728f/superio.c +++ b/src/superio/ite/it8728f/superio.c @@ -20,7 +20,7 @@ switch (dev->path.pnp.device) { /* TODO: Might potentially need code for FDC etc. */ case IT8728F_EC: - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8772f/superio.c b/src/superio/ite/it8772f/superio.c index 6672cdc..82f30fa 100644 --- a/src/superio/ite/it8772f/superio.c +++ b/src/superio/ite/it8772f/superio.c @@ -171,7 +171,7 @@
switch (dev->path.pnp.device) { case IT8772F_EC: - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!res) break;
@@ -203,7 +203,7 @@ break; case IT8772F_GPIO: /* Set GPIO output levels */ - res = find_resource(dev, PNP_IDX_IO1); + res = probe_resource(dev, PNP_IDX_IO1); if (res) { if (conf->gpio_set1) outb(conf->gpio_set1, res->base + 0); diff --git a/src/superio/ite/it8783ef/superio.c b/src/superio/ite/it8783ef/superio.c index feb373f..d90ae5f 100644 --- a/src/superio/ite/it8783ef/superio.c +++ b/src/superio/ite/it8783ef/superio.c @@ -20,7 +20,7 @@ switch (dev->path.pnp.device) { case IT8783EF_EC: conf = dev->chip_info; - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/ite/it8786e/superio.c b/src/superio/ite/it8786e/superio.c index 55fff91..8d9ec14 100644 --- a/src/superio/ite/it8786e/superio.c +++ b/src/superio/ite/it8786e/superio.c @@ -20,7 +20,7 @@ switch (dev->path.pnp.device) { case IT8786E_EC: conf = dev->chip_info; - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!conf || !res) break; ite_ec_init(res->base, &conf->ec); diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c index 9889980..f1db509 100644 --- a/src/superio/nuvoton/npcd378/superio.c +++ b/src/superio/nuvoton/npcd378/superio.c @@ -60,7 +60,7 @@ pc_keyboard_init(PROBE_AUX_DEVICE); break; case NPCD378_HWM: - res = find_resource(dev, PNP_IDX_IO0); + res = probe_resource(dev, PNP_IDX_IO0); if (!res || !res->base) { printk(BIOS_ERR, "NPCD378: LDN%u IOBASE not set.\n", NPCD378_HWM); break;