Skip to contentSkip to conversation

lm-sensors: Fix error seen with

PATCH In review Guenter Roeck 2 participants 4 messages Oct 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lm-sensors: Fix error seen with

The following patch fixes an error seen in sensors-detect if i2c bus numbering is not sequential. Problem is that in this case, $i2c_adapters[] does not exist for all index values, causing an error message whenever one of the non-existing objects is accessed.

The error message is:
Use of uninitialized value in string eq at ./sensors-detect line 5941.

v2: Keep foreach loop. Check if loop object is defined in each iteration.

--
Index: prog/detect/sensors-detect
=================================--- prog/detect/sensors-detect (revision 5868)
+++ prog/detect/sensors-detect (working copy)
@@ -5937,6 +5937,7 @@

 	# the adapter drivers so that the numbers will be the same. If not, then
 	# we only load the adapter drivers which are useful.
 	foreach $adap (@i2c_adapters) {
+		next unless defined $adap;
 		next if $adap->{autoload};
 		next if $adap->{driver} eq 'UNKNOWN';
 		next if not defined $configfile and not $adap->{used};

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 16 lines · Guenter Roeck

The following patch fixes an error seen in sensors-detect if i2c bus numbering is not sequential. Problem is that in this case, $i2c_adapters[] does not exist for all index values, causing an error message whenever one of the non-existing objects is accessed.

The error message is:
Use of uninitialized value in string eq at ./sensors-detect line 5941.

v2: Keep foreach loop. Check if loop object is defined in each iteration.

--
Index: prog/detect/sensors-detect
=================================> --- prog/detect/sensors-detect (revision 5868)
+++ prog/detect/sensors-detect (working copy)

Review line 5943

Quoted 7 lines
(quoted diff) +1 -0
@@ -5937,6 +5937,7 @@
 	# the adapter drivers so that the numbers will be the same. If not, then
 	# we only load the adapter drivers which are useful.
 	foreach $adap (@i2c_adapters) {
+		next unless defined $adap;
 		next if $adap->{autoload};
 		next if $adap->{driver} eq 'UNKNOWN';
 		next if not defined $configfile and not $adap->{used};

Looks good, please commit and add to the list of recommended patches.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Guenter Roeck
Quoted 11 lines · Jean Delvare
Quoted 10 lines · Guenter Roeck

The following patch fixes an error seen in sensors-detect if i2c bus numbering is not sequential. Problem is that in this case, $i2c_adapters[] does not exist for all index values, causing an error message whenever one of the non-existing objects is accessed.

The error message is:
Use of uninitialized value in string eq at ./sensors-detect line 5941.

v2: Keep foreach loop. Check if loop object is defined in each iteration.

Quoted 16 lines

Review line 5943

Quoted 13 lines

--
Index: prog/detect/sensors-detect
=================================> > --- prog/detect/sensors-detect (revision 5868)
+++ prog/detect/sensors-detect (working copy)

(quoted diff) +1 -0
@@ -5937,6 +5937,7 @@
 	# the adapter drivers so that the numbers will be the same. If not, then
 	# we only load the adapter drivers which are useful.
 	foreach $adap (@i2c_adapters) {
+		next unless defined $adap;
 		next if $adap->{autoload};
 		next if $adap->{driver} eq 'UNKNOWN';
 		next if not defined $configfile and not $adap->{used};

Looks good, please commit and add to the list of recommended patches.

The list of recommended patches on lm-sensors.org currently points to r5768. Should that be r5868 ?

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Guenter Roeck
Quoted 28 lines · Guenter Roeck
Quoted 11 lines · Jean Delvare
Quoted 10 lines · Guenter Roeck

The following patch fixes an error seen in sensors-detect if i2c bus numbering is not sequential. Problem is that in this case, $i2c_adapters[] does not exist for all index values, causing an error message whenever one of the non-existing objects is accessed.

The error message is:
Use of uninitialized value in string eq at ./sensors-detect line 5941.

v2: Keep foreach loop. Check if loop object is defined in each iteration.

Quoted 16 lines

Review line 5943

Quoted 13 lines

--
Index: prog/detect/sensors-detect
=================================> > > --- prog/detect/sensors-detect (revision 5868)
+++ prog/detect/sensors-detect (working copy)

(quoted diff) +1 -0
@@ -5937,6 +5937,7 @@
 	# the adapter drivers so that the numbers will be the same. If not, then
 	# we only load the adapter drivers which are useful.
 	foreach $adap (@i2c_adapters) {
+		next unless defined $adap;
 		next if $adap->{autoload};
 		next if $adap->{driver} eq 'UNKNOWN';
 		next if not defined $configfile and not $adap->{used};

Looks good, please commit and add to the list of recommended patches.

Quoted 2 lines

The list of recommended patches on lm-sensors.org currently points to r5768. Should that be r5868 ?

Ignore this. That was for an older version of libsensors.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors