unbind.sh: fix ioat unbind to work with 'set -e'

Since the grep would fail for most devices and the result wasn't
checked, the script would exit on the first device ID that didn't match.

Also initialize $rootdir so ioat_pci.h can be located.

Change-Id: I6a714772e22692ab002e1971134d2a86edc81d92
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-02-03 17:51:05 -07:00
parent 3c10754a8d
commit 53d6437bb5

View File

@ -2,6 +2,8 @@
set -e
rootdir=$(readlink -f $(dirname $0))/..
function prep_nvme {
TMP=`mktemp`
# Get vendor_id:device_id by nvme's class_id and subcalss_id
@ -24,8 +26,7 @@ function prep_ioat {
for device in `cat $TMP`
do
result=`lspci -n | grep "$vendor:$device"`
if [ "$result" ]
if lspci -n | grep "$vendor:$device"
then
echo $vendor $device > /sys/bus/pci/drivers/uio_pci_generic/new_id
fi