[SeaBIOS] [PATCH 3/3] tpm: Add a menu for TPM configuration

Kevin O'Connor kevin at koconnor.net
Mon Nov 30 15:22:24 CET 2015


On Mon, Nov 30, 2015 at 06:02:45AM +0100, Peter Stuge wrote:
> Stefan Berger wrote:
> > +++ b/src/tcgbios.c
> > +static u32
> > +read_stclear_flags(char *buf, int buf_len)
> > +{
> ..
> > +    if (rc || returnCode)
> > +        goto err_exit;
> ..
> > +err_exit:
> > +    dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__);
> 
> I can't help but think that it would be significantly more useful to
> turn the "goto err_exit" into a macro everywhere. Something like:
> 
> #define malfunc_err_exit() do { \
>   dprintf(DEBUG_tcg, "TCGBIOS: TPM malfunctioning (line %d).\n", __LINE__); \
>   goto err_exit; \
> } while (0)
> 
> ..so that the line number of the actual problem is output.

I find goto's out of macros to be confusing, so would prefer to avoid
that.

If there is a desire to shrink the number of error messages, the
generic warn_internalerror(), warn_timeout(), and warn_noalloc()
macros are available.  We could add a generic warn_hwerror().

-Kevin



More information about the SeaBIOS mailing list