From 5741c56213acf2bdecb9d396e6e57eee7aa08dfe Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 19 Aug 2007 15:27:14 +0000 Subject: [PATCH] Contrary to what the comment says, sensors_proc_bus_count may be a perfectly valid bus number. We need to use a different value for chip configuration entries we want to ignore. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4690 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/data.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/data.c b/lib/data.c index e84a6da4..bfe0847a 100644 --- a/lib/data.c +++ b/lib/data.c @@ -225,6 +225,8 @@ int sensors_parse_i2cbus_name(const char *name, int *res) } +#define SENSORS_CHIP_NAME_BUS_IGNORE -42 + int sensors_substitute_chip(sensors_chip_name *name,int lineno) { int i,j; @@ -234,7 +236,7 @@ int sensors_substitute_chip(sensors_chip_name *name,int lineno) if (i == sensors_config_busses_count) { sensors_parse_error("Undeclared i2c bus referenced",lineno); - name->bus = sensors_proc_bus_count; + name->bus = SENSORS_CHIP_NAME_BUS_IGNORE; return -SENSORS_ERR_BUS_NAME; } @@ -249,9 +251,9 @@ int sensors_substitute_chip(sensors_chip_name *name,int lineno) } } - /* We did not find anything. sensors_proc_bus_count is not a valid - bus number, so it will never be matched. Good. */ - name->bus = sensors_proc_bus_count; + /* We did not find a matching bus name, simply ignore this chip + config entry. */ + name->bus = SENSORS_CHIP_NAME_BUS_IGNORE; return 0; }