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>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58909
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Werner Zeh <werner.zeh@siemens.com>
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);