summaryrefslogtreecommitdiff
path: root/src/superio/ite
diff options
context:
space:
mode:
authorAngel Pons <th3fanbus@gmail.com>2021-11-03 13:25:02 +0100
committerFelix Held <felix-coreboot@felixheld.de>2021-11-04 17:36:32 +0000
commitc167b748686529fa9f9c667f57cba6519220b341 (patch)
tree6b00bafa689344290da8875b42b50501469044e4 /src/superio/ite
parente058841913f8374dfa511f56504e21659c46769e (diff)
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>
Diffstat (limited to 'src/superio/ite')
-rw-r--r--src/superio/ite/it8613e/superio.c2
-rw-r--r--src/superio/ite/it8623e/superio.c2
-rw-r--r--src/superio/ite/it8718f/superio.c2
-rw-r--r--src/superio/ite/it8720f/superio.c2
-rw-r--r--src/superio/ite/it8728f/superio.c2
-rw-r--r--src/superio/ite/it8772f/superio.c4
-rw-r--r--src/superio/ite/it8783ef/superio.c2
-rw-r--r--src/superio/ite/it8786e/superio.c2
8 files changed, 9 insertions, 9 deletions
diff --git a/src/superio/ite/it8613e/superio.c b/src/superio/ite/it8613e/superio.c
index 4d12457e0d..c18c3ec357 100644
--- a/src/superio/ite/it8613e/superio.c
+++ b/src/superio/ite/it8613e/superio.c
@@ -19,7 +19,7 @@ static void it8613e_init(struct device *dev)
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 ca3455ae1e..15e0071db8 100644
--- a/src/superio/ite/it8623e/superio.c
+++ b/src/superio/ite/it8623e/superio.c
@@ -19,7 +19,7 @@ static void it8623e_init(struct device *dev)
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 aab554fe95..1243e75fcf 100644
--- a/src/superio/ite/it8718f/superio.c
+++ b/src/superio/ite/it8718f/superio.c
@@ -24,7 +24,7 @@ static void init(struct device *dev)
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 c63fa9ab4f..75d0be9c02 100644
--- a/src/superio/ite/it8720f/superio.c
+++ b/src/superio/ite/it8720f/superio.c
@@ -51,7 +51,7 @@ static void it8720f_init(struct device *dev)
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 22e6ecbf95..67ef2181fd 100644
--- a/src/superio/ite/it8728f/superio.c
+++ b/src/superio/ite/it8728f/superio.c
@@ -20,7 +20,7 @@ static void it8728f_init(struct device *dev)
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 6672cdc979..82f30fa6cd 100644
--- a/src/superio/ite/it8772f/superio.c
+++ b/src/superio/ite/it8772f/superio.c
@@ -171,7 +171,7 @@ static void it8772f_init(struct device *dev)
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 @@ static void it8772f_init(struct device *dev)
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 feb373f709..d90ae5f3b7 100644
--- a/src/superio/ite/it8783ef/superio.c
+++ b/src/superio/ite/it8783ef/superio.c
@@ -20,7 +20,7 @@ static void it8783ef_init(struct device *const dev)
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 55fff9154d..8d9ec1477e 100644
--- a/src/superio/ite/it8786e/superio.c
+++ b/src/superio/ite/it8786e/superio.c
@@ -20,7 +20,7 @@ static void it8786e_init(struct device *const dev)
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);