If validate_output_format() fails, there are a couple of paths in the
solidgm code that will return a (closed) file descriptor, rather than an
error status. This looks to be a couple of copy-and-paste errors.
This change fixes the return value for these failure path, ensuring that
we'll actually have an error return.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
if (flags == -EINVAL) {
fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format);
close(fd);
- return fd;
+ return flags;
}
garbage_control_collection_log_t gc_log;
if (flags == -EINVAL) {
fprintf(stderr, "Invalid output format '%s'\n", cfg.output_format);
close(fd);
- return fd;
+ return flags;
}
err = nvme_get_log_simple(fd, solidigm_vu_smart_log_id, sizeof(smart_log_payload), &smart_log_payload);