If a pci load instruction fails the content of the register where the
data is stored is possibly unchanged. Fix the inline assembly wrapper
__pcilg to not return stale data. Additionally fix the callers of this
function who access uninitialized variables.
Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
int cc;
cc = s390pci_load(&data, req, offset);
+ if (cc)
+ goto out;
+
switch (len) {
case 1:
*((u8 *) dst) = (u8) data;
*((u64 *) dst) = (u64) data;
break;
}
+out:
return cc;
}
int rc;
rc = s390pci_load(&data, req, offset);
- data = data << ((8 - len) * 8);
- data = le64_to_cpu(data);
- if (!rc)
+ if (!rc) {
+ data = data << ((8 - len) * 8);
+ data = le64_to_cpu(data);
*val = (u32) data;
- else
+ } else
*val = 0xffffffff;
return rc;
}
: "d" (__offset)
: "cc");
*status = __req >> 24 & 0xff;
- *data = __data;
+ if (!cc)
+ *data = __data;
+
return cc;
}