From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Allen Martin <amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCHv2 09/11] tegrarcm: Add readbct support
Date: Tue, 17 Sep 2013 15:19:52 -0600 [thread overview]
Message-ID: <5238C778.1030805@wwwdotorg.org> (raw)
In-Reply-To: <1379370298-20404-10-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
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.
next prev parent reply other threads:[~2013-09-17 21:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-16 22:24 [PATCHv2 00/11] tegrarcm: T124 and new command support Allen Martin
[not found] ` <1379370298-20404-1-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-16 22:24 ` [PATCHv2 01/11] tegrarcm: Change NVIDIA license to apply to all miniloader files Allen Martin
2013-09-16 22:24 ` [PATCHv2 02/11] tegrarcm: Add missing SKU information Allen Martin
2013-09-16 22:24 ` [PATCHv2 03/11] tegrarcm: Add support for RCM protocol version 40 Allen Martin
2013-09-16 22:24 ` [PATCHv2 05/11] tegrarcm: Add Tegra124 support Allen Martin
2013-09-16 22:24 ` [PATCHv2 06/11] tegrarcm: Add timeout to USB xfers Allen Martin
2013-09-16 22:24 ` [PATCHv2 07/11] tegrarcm: Assume nv3p server is running if RCM doesn't respond Allen Martin
2013-09-16 22:24 ` [PATCHv2 08/11] tegrarcm: Clean up usage info Allen Martin
2013-09-16 22:24 ` [PATCHv2 09/11] tegrarcm: Add readbct support Allen Martin
[not found] ` <1379370298-20404-10-git-send-email-amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-17 21:19 ` Stephen Warren [this message]
2013-09-16 22:24 ` [PATCHv2 10/11] tegrarcm: Add command to pass miniloader in from file Allen Martin
2013-09-16 22:24 ` [PATCHv2 11/11] tegrarcm: Bump version to 1.5 Allen Martin
2013-09-17 21:21 ` [PATCHv2 00/11] tegrarcm: T124 and new command support Stephen Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5238C778.1030805@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=amartin-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.