This reverts commit
3089da58d2c35b3b700c1eb88540f96cfe0e87ad.
The result field is undefined for many commands and thus can have random values.
Thus we can't blindly evaluate these for all commands.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
{
int err = ioctl(fd, ioctl_cmd, cmd);
- if (err >= 0) {
- if (result)
- *result = cmd->result;
- if (cmd->result) {
- errno = EPROTO;
- err = -1;
- }
- }
+ if (err >= 0 && result)
+ *result = cmd->result;
return err;
}
{
int err = ioctl(fd, ioctl_cmd, cmd);
- if (err >= 0) {
- if (result)
- *result = cmd->result;
- if (cmd->result) {
- errno = EPROTO;
- err = -1;
- }
- }
+ if (err >= 0 && result)
+ *result = cmd->result;
return err;
}
#define TEST_CDW15 0x15151515
#define TEST_UUIDX 0b1001110
#define TEST_FID 0xFE
-#define TEST_RESULT 0x0
+#define TEST_RESULT 0x12345678
#define TEST_SEL NVME_GET_FEATURES_SEL_SAVED
#define TEST_SC NVME_SC_INVALID_FIELD