File s390-tools-sles15sp1-01-zpcictl-Fix-compile-warning.patch of Package s390-tools.14411
Subject: [PATCH] [BZ 184174] zpcictl: Fix compile warning
From: Jan Hoeppner <hoeppner@linux.ibm.com>
Description: zpcictl: Initiate recover after reset
Symptom: If a PCI function is reset using zpcictl --reset, the function
is in an error state.
Problem: zpcictl --reset only issues a SCLP reset and leaves the PCI
function in an error state.
Solution: Initiate an OS level recovery by calling
/sys/bus/devices/<dev>/recover after the SCLP reset.
Reproduction: Call zpcictl --reset <dev>
Under z/VM check the state of the function with 'vmcp q pcif'
Upstream-ID: 73bab8e1a1dd93a90ffb5a39e4dc91f194a2f063
Problem-ID: 184174
Upstream-Description:
zpcictl: Fix compile warning
zpcictl.c: In function 'sysfs_read_value':
zpcictl.c:154:2: warning: ignoring return value of 'fscanf', declared with
attribute warn_unused_result [-Wunused-result]
fscanf(fp, "%x", &val);
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
zpcictl/zpcictl.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/zpcictl/zpcictl.c
+++ b/zpcictl/zpcictl.c
@@ -150,7 +150,12 @@ static unsigned int sysfs_read_value(str
fp = fopen(path, "r");
if (!fp)
fopen_err(path);
- fscanf(fp, "%x", &val);
+ if (fscanf(fp, "%x", &val) != 1) {
+ fclose(fp);
+ warnx("Could not read file %s: %s", path, strerror(errno));
+ free(path);
+ exit(EXIT_FAILURE);
+ }
fclose(fp);
free(path);