This patch avoids that shellcheck reports the following:

tests/block/002:34:7: note: Use _init_scsi_debug "$@" if function's $1 should 
mean script's $1. [SC2119]

Signed-off-by: Bart Van Assche <[email protected]>
---
 common/scsi_debug | 3 +++
 tests/block/002   | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/scsi_debug b/common/scsi_debug
index e26e85637369..d8e6b71899a3 100644
--- a/common/scsi_debug
+++ b/common/scsi_debug
@@ -21,7 +21,10 @@ _have_scsi_debug() {
        _have_module scsi_debug
 }
 
+# The _init_scsi_debug() argument list is passed to modprobe scsi_debug. "--"
+# is filtered out from the start of the argument list.
 _init_scsi_debug() {
+       [ "$1" = "--" ] && shift
        if ! modprobe -r scsi_debug || ! modprobe scsi_debug "$@"; then
                return 1
        fi
diff --git a/tests/block/002 b/tests/block/002
index 32a0f818b95b..10e3f157c018 100755
--- a/tests/block/002
+++ b/tests/block/002
@@ -31,7 +31,7 @@ requires() {
 test() {
        echo "Running ${TEST_NAME}"
 
-       if ! _init_scsi_debug; then
+       if ! _init_scsi_debug --; then
                return 1
        fi
 
-- 
2.17.1

Reply via email to