On 09/16/2013 04:24 PM, Allen Martin wrote:
> Add a new command "readbct" which will read the BCT from the target
> system and write it to bctfile.
> diff --git a/src/main.c b/src/main.c
> +static int read_bct(nv3p_handle_t h3p, char *filename)
> + buf = bct_data;
> + while(bct_info.length > 0) {
> + ssize_t written = write(fd, buf, bct_info.length);
> + if (written == -1) {
> + if (errno == EINTR)
> + continue;
> + dprintf("error writing to %s\n", filename);
> + return errno;
"ret = errno; goto out;" might be more appropriate there ...
> + }
> + buf += written;
> + bct_info.length -= written;
> + }
> +
> + free(bct_data);
> + close(fd);
> + return 0;
and that could be:
ret = 0;
out:
free(bct_data);
close(fd);
return ret;
That way, everything gets closed/freed in the error paths to, albeit
it's not too relevant since the app will just immediately exit anyway.
Perhaps some of the other error paths also skip cleanup; I didn't check.
Feel free to fix this up as you apply or as a separate patch later.
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html