script: fix a setup.sh error "No such file"

Error log as below:
06:27:53    # nvme_namespace_revert
06:27:53   # /home/storage/workspace/opal-end-to-end-reservation-autotest/spdk/scripts/setup.sh
/home/storage/workspace/opal-end-to-end-reservation-autotest/spdk/scripts/setup.sh: line 109: /sys/bus/pci/devices/0000:80:04.2/driver/remove_id: No such file or directory
home/storage/workspace/opal-end-to-end-reservation-autotest/spdk/scripts/setup.sh: line 110: /sys/bus/pci/devices/0000:80:04.2/driver/unbind: No such file or directory
 06:27:54 # trap - ERR

Change-Id: I302e58143f0e165b17a9b5edd14121e6282f55a7
Signed-off-by: wanghailiangx <hailiangx.e.wang@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4094
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
wanghailiangx 2020-09-08 12:02:30 -04:00 committed by Tomasz Zawadzki
parent 77ab6f2839
commit 6ca498c197

View File

@ -106,8 +106,10 @@ function linux_bind_driver() {
return 0
fi
echo "$ven_dev_id" > "/sys/bus/pci/devices/$bdf/driver/remove_id" 2> /dev/null || true
echo "$bdf" > "/sys/bus/pci/devices/$bdf/driver/unbind"
if [[ $old_driver_name != "no driver" ]]; then
echo "$ven_dev_id" > "/sys/bus/pci/devices/$bdf/driver/remove_id" 2> /dev/null || true
echo "$bdf" > "/sys/bus/pci/devices/$bdf/driver/unbind"
fi
pci_dev_echo "$bdf" "$old_driver_name -> $driver_name"