File 0005-ofpathname-skip-devices-with-no-devspec-when-coorela.patch of Package powerpc-utils.35048

From a56028561ad9c01b5d3a767e50455c561e09191c Mon Sep 17 00:00:00 2001
From: Tyrel Datwyler <tyreld@linux.ibm.com>
Date: Fri, 26 Jul 2024 16:17:47 -0700
Subject: [PATCH] ofpathname: skip devices with no devspec when coorelating FC
 OF paths

Upstream: merged, expected in v1.3.13
Git-commit: a56028561ad9c01b5d3a767e50455c561e09191c

When using ofpathname to find the logical device associated to a Fibre
Channel or Virtual Fibre Channel OF path an ERR_NO_SYSFS_DEVINFO error
can be returned if a device with no devspec attribute is in the list of
devices to cross reference.

If a device with no devspec is found simply skip it an continue the
for-loop device search.

Signed-off-by: Tyrel Datwyler <tyreld@linux.ibm.com>
---
 scripts/ofpathname | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/scripts/ofpathname b/scripts/ofpathname
index 833d03f..711ab62 100755
--- a/scripts/ofpathname
+++ b/scripts/ofpathname
@@ -1649,10 +1649,14 @@ of2l_vfc()
         link=$PWD
 
         local device_dir=${PWD##/*/}
-        goto_dir $PWD "devspec"
+        goto_dir $PWD "devspec" 0
+	if [[ $? -eq 1 ]]; then
+		continue;
+	fi
         OF_PATH=`$CAT $PWD/devspec`
+
         if [[ -z $OF_PATH ]]; then
-                err $ERR_NO_LOGDEV
+		err $ERR_NO_LOGDEV
         fi
 
         # Skip if this is not the correct FC port
@@ -1727,10 +1731,14 @@ of2l_fc()
 
 	cd $link
         local device_dir=${PWD##/*/}
-        goto_dir $PWD "devspec"
+        goto_dir $PWD "devspec" 0
+	if [[ $? -eq 1 ]]; then
+		continue;
+	fi
         OF_PATH=`$CAT devspec`
+
         if [[ -z $OF_PATH ]]; then
-                err $ERR_NO_LOGDEV
+		err $ERR_NO_LOGDEV;
         fi
 
         # Skip if this is not the correct FC port
-- 
2.45.2

openSUSE Build Service is sponsored by