[PATCH blktests 1/4] common/rc: test have_driver before check its driver parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Similar to previous _have_module_param_value() and to improve efficiency
and avoid unnecessary error messages, _have_module_param() should first
verify the presence of the driver using _have_driver(). This change
prevents redundant checks if the driver is not available.

Previously, an unintended error message 'modinfo: ERROR: Module scsi_debug not found'
was displayed before the test execution. For example:

 # ./check scsi/005
 modinfo: ERROR: Module scsi_debug not found.
 scsi/005 (test SCSI device blacklisting)                     [not run]
    driver scsi_debug is not available
    module scsi_debug does not have parameter inq_vendor

Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
---
 common/rc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/common/rc b/common/rc
index 0c8b51f64291..7fd178b01989 100644
--- a/common/rc
+++ b/common/rc
@@ -77,6 +77,8 @@ _have_module() {
 }
 
 _have_module_param() {
+	 _have_driver "$1" || return
+
 	if [ -d "/sys/module/$1" ]; then
 		if [ -e "/sys/module/$1/parameters/$2" ]; then
 			return 0
@@ -96,10 +98,6 @@ _have_module_param_value() {
 	local expected_value="$3"
 	local value
 
-	if ! _have_driver "$modname"; then
-		return 1;
-	fi
-
 	if ! _have_module_param "$modname" "$param"; then
 		return 1
 	fi
-- 
2.47.0





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux