diff --git a/tools/testing/selftests/power_supply/helpers.sh b/tools/testing/selftests/power_supply/helpers.sh index 1ec90d7c9108..ff1175aeed72 100644 --- a/tools/testing/selftests/power_supply/helpers.sh +++ b/tools/testing/selftests/power_supply/helpers.sh @@ -108,7 +108,7 @@ test_sysfs_prop_optional_range() { test_sysfs_prop_optional_list() { PROP=$1 - LIST=$2 + shift TEST_NAME="$DEVNAME".sysfs."$PROP" @@ -118,9 +118,9 @@ test_sysfs_prop_optional_list() { valid=0 OLDIFS=$IFS - IFS="," - for item in $LIST; do - if [ "$DATA" = "$item" ]; then + IFS=",$IFS" + for item in $*; do + if [ "$item" ] && [ "$DATA" = "$item" ]; then valid=1 break fi