From 53d6437bb5b020f1776878741fb427634831234c Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Wed, 3 Feb 2016 17:51:05 -0700 Subject: [PATCH] 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 --- scripts/unbind.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/unbind.sh b/scripts/unbind.sh index dd09841fa..a99a60ec0 100755 --- a/scripts/unbind.sh +++ b/scripts/unbind.sh @@ -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