qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Alistair Francis <alistair.francis@xilinx.com>, qemu-devel@nongnu.org
Cc: alistair23@gmail.com, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 07/47] hw/bt: Replace fprintf(stderr, "*\n" with error_report()
Date: Sun, 1 Oct 2017 16:06:30 +0200	[thread overview]
Message-ID: <6ca0c9fa-0e28-cd41-70d6-aedfc23055d6@redhat.com> (raw)
In-Reply-To: <3400959d36218ad30e914439ab5d893ed9c87aae.1506730372.git.alistair.francis@xilinx.com>

On 30.09.2017 02:15, Alistair Francis wrote:
> Replace a large number of the fprintf(stderr, "*\n" calls with
> error_report(). The functions were renamed with these commands and then
> compiler issues where manually fixed.
[...]
> diff --git a/hw/bt/core.c b/hw/bt/core.c
> index c1806b71a3..a6e9bf2a3e 100644
> --- a/hw/bt/core.c
> +++ b/hw/bt/core.c
> @@ -18,6 +18,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qemu-common.h"
>  #include "sysemu/bt.h"
>  #include "hw/bt.h"
> @@ -31,24 +32,24 @@ static void bt_dummy_lmp_mode_change(struct bt_link_s *link)
>  static void bt_dummy_lmp_connection_complete(struct bt_link_s *link)
>  {
>      if (link->slave->reject_reason)
> -        fprintf(stderr, "%s: stray LMP_not_accepted received, fixme\n",
> -                        __func__);
> +        error_report("%s: stray LMP_not_accepted received, fixme",
> +                     __func__);
>      else
> -        fprintf(stderr, "%s: stray LMP_accepted received, fixme\n",
> -                        __func__);
> +        error_report("%s: stray LMP_accepted received, fixme",
> +                     __func__);

I think these lines should now also easily fit into one line only.

>      exit(-1);
>  }
>  
>  static void bt_dummy_lmp_disconnect_master(struct bt_link_s *link)
>  {
> -    fprintf(stderr, "%s: stray LMP_detach received, fixme\n", __func__);
> +    fprintf(stderr, "%s: stray LMP_detach received, fixme", __func__);
>      exit(-1);
>  }
>  
>  static void bt_dummy_lmp_acl_resp(struct bt_link_s *link,
>                  const uint8_t *data, int start, int len)
>  {
> -    fprintf(stderr, "%s: stray ACL response PDU, fixme\n", __func__);
> +    error_report("%s: stray ACL response PDU, fixme", __func__);
>      exit(-1);
>  }
>  
> @@ -113,7 +114,7 @@ void bt_device_done(struct bt_device_s *dev)
>      while (*p && *p != dev)
>          p = &(*p)->next;
>      if (*p != dev) {
> -        fprintf(stderr, "%s: bad bt device \"%s\"\n", __func__,
> +        error_report("%s: bad bt device \"%s\"", __func__,
>                          dev->lmp_name ?: "(null)");

Bad indentation of the second line.

>          exit(-1);
>      }
> diff --git a/hw/bt/hci-csr.c b/hw/bt/hci-csr.c
> index ac067b81f6..6a171a54b7 100644
> --- a/hw/bt/hci-csr.c
> +++ b/hw/bt/hci-csr.c
> @@ -19,6 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qemu-common.h"
>  #include "chardev/char-serial.h"
>  #include "qemu/timer.h"
> @@ -111,14 +112,14 @@ static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len)
>  
>      if (off < FIFO_LEN) {
>          if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) {
> -            fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
> +            error_report("%s: can't alloc %i bytes", __func__, len);
>              exit(-1);
>          }
>          return s->outfifo + off;
>      }
>  
>      if (s->out_len > s->out_size) {
> -        fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
> +        error_report("%s: can't alloc %i bytes", __func__, len);
>          exit(-1);
>      }
>  
> @@ -168,8 +169,8 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,
>              s->bd_addr.b[5] = data[offset + 2];
>  
>              s->hci->bdaddr_set(s->hci, s->bd_addr.b);
> -            fprintf(stderr, "%s: bd_address loaded from firmware: "
> -                            "%02x:%02x:%02x:%02x:%02x:%02x\n", __func__,
> +            error_report("%s: bd_address loaded from firmware: "
> +                            "%02x:%02x:%02x:%02x:%02x:%02x", __func__,
>                              s->bd_addr.b[0], s->bd_addr.b[1], s->bd_addr.b[2],
>                              s->bd_addr.b[3], s->bd_addr.b[4], s->bd_addr.b[5]);

Bad indentation again.

>          }
> @@ -181,7 +182,7 @@ static void csrhci_in_packet_vendor(struct csrhci_s *s, int ocf,
>          break;
>  
>      default:
> -        fprintf(stderr, "%s: got a bad CMD packet\n", __func__);
> +        error_report("%s: got a bad CMD packet", __func__);
>          return;
>      }
>  
> @@ -226,7 +227,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)
>      case H4_NEG_PKT:
>          if (s->in_hdr != sizeof(csrhci_neg_packet) ||
>                          memcmp(pkt - 1, csrhci_neg_packet, s->in_hdr)) {
> -            fprintf(stderr, "%s: got a bad NEG packet\n", __func__);
> +            error_report("%s: got a bad NEG packet", __func__);
>              return;
>          }
>          pkt += 2;
> @@ -241,7 +242,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)
>  
>      case H4_ALIVE_PKT:
>          if (s->in_hdr != 4 || pkt[1] != 0x55 || pkt[2] != 0x00) {
> -            fprintf(stderr, "%s: got a bad ALIVE packet\n", __func__);
> +            error_report("%s: got a bad ALIVE packet", __func__);
>              return;
>          }
>  
> @@ -254,7 +255,7 @@ static void csrhci_in_packet(struct csrhci_s *s, uint8_t *pkt)
>      default:
>      bad_pkt:
>          /* TODO: error out */
> -        fprintf(stderr, "%s: got a bad packet\n", __func__);
> +        error_report("%s: got a bad packet", __func__);
>          break;
>      }
>  
> diff --git a/hw/bt/hci.c b/hw/bt/hci.c
> index df05f07887..ac9394daf0 100644
> --- a/hw/bt/hci.c
> +++ b/hw/bt/hci.c
> @@ -19,6 +19,7 @@
>   */
>  
>  #include "qemu/osdep.h"
> +#include "qemu/error-report.h"
>  #include "qapi/error.h"
>  #include "qemu-common.h"
>  #include "qemu/timer.h"
> @@ -457,7 +458,7 @@ static inline uint8_t *bt_hci_event_start(struct bt_hci_s *hci,
>      int mask_byte;
>  
>      if (len > 255) {
> -        fprintf(stderr, "%s: HCI event params too long (%ib)\n",
> +        error_report("%s: HCI event params too long (%ib)",
>                          __func__, len);

Bad indentation again - or even better: Put it into one line only.

>          exit(-1);
>      }
> @@ -589,7 +590,7 @@ static void bt_hci_inquiry_result(struct bt_hci_s *hci,
>          bt_hci_inquiry_result_with_rssi(hci, slave);
>          return;
>      default:
> -        fprintf(stderr, "%s: bad inquiry mode %02x\n", __func__,
> +        error_report("%s: bad inquiry mode %02x", __func__,
>                          hci->lm.inquiry_mode);

Bad indentation.

>          exit(-1);
>      }
> @@ -1971,7 +1972,7 @@ static void bt_submit_hci(struct HCIInfo *info,
>          break;
>  
>      short_hci:
> -        fprintf(stderr, "%s: HCI packet too short (%iB)\n",
> +        error_report("%s: HCI packet too short (%iB)",
>                          __func__, length);

One line, please.

>          bt_hci_event_status(hci, HCI_INVALID_PARAMETERS);
>          break;
> @@ -1991,7 +1992,7 @@ static inline void bt_hci_lmp_acl_data(struct bt_hci_s *hci, uint16_t handle,
>      /* TODO: avoid memcpy'ing */
>  
>      if (len + HCI_ACL_HDR_SIZE > sizeof(hci->acl_buf)) {
> -        fprintf(stderr, "%s: can't take ACL packets %i bytes long\n",
> +        error_report("%s: can't take ACL packets %i bytes long",
>                          __func__, len);

Fix indentation or put it on one line.

>          return;
>      }
> @@ -2029,7 +2030,7 @@ static void bt_submit_acl(struct HCIInfo *info,
>      struct bt_link_s *link;
>  
>      if (length < HCI_ACL_HDR_SIZE) {
> -        fprintf(stderr, "%s: ACL packet too short (%iB)\n",
> +        error_report("%s: ACL packet too short (%iB)",
>                          __func__, length);

One line.

>          return;
>      }
> @@ -2041,15 +2042,15 @@ static void bt_submit_acl(struct HCIInfo *info,
>      length -= HCI_ACL_HDR_SIZE;
>  
>      if (bt_hci_handle_bad(hci, handle)) {
> -        fprintf(stderr, "%s: invalid ACL handle %03x\n",
> -                        __func__, handle);
> +        error_report("%s: invalid ACL handle %03x",
> +                     __func__, handle);

One line.

>          /* TODO: signal an error */
>          return;
>      }
>      handle &= ~HCI_HANDLE_OFFSET;
>  
>      if (datalen > length) {
> -        fprintf(stderr, "%s: ACL packet too short (%iB < %iB)\n",
> +        fprintf(stderr, "%s: ACL packet too short (%iB < %iB)",
>                          __func__, length, datalen);

script failure?

>          return;
>      }
> @@ -2060,7 +2061,7 @@ static void bt_submit_acl(struct HCIInfo *info,
>          if (!hci->asb_handle)
>              hci->asb_handle = handle;
>          else if (handle != hci->asb_handle) {
> -            fprintf(stderr, "%s: Bad handle %03x in Active Slave Broadcast\n",
> +            error_report("%s: Bad handle %03x in Active Slave Broadcast",
>                              __func__, handle);

Indentation.

etc.

Please have a look at all the hunks in this patch before you submit it
again!

 Thomas

  reply	other threads:[~2017-10-01 14:06 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  0:14 [Qemu-devel] [PATCH v2 00/47] Remove some of the fprintf(stderr, "* Alistair Francis
2017-09-30  0:14 ` [Qemu-devel] [PATCH v2 01/47] Replace all occurances of __FUNCTION__ with __func__ Alistair Francis
2017-10-02 14:11   ` Stefan Hajnoczi
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 02/47] Fixes after renaming __FUNCTION__ to __func__ Alistair Francis
2017-09-30  6:31   ` Thomas Huth
2017-10-02 14:00   ` Eric Blake
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 03/47] audio: Replace AUDIO_FUNC with __func__ Alistair Francis
2017-09-30  6:35   ` Thomas Huth
2017-10-02 14:08   ` Eric Blake
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 04/47] tests: Replace fprintf(stderr, "*\n" with error_report() Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 05/47] hw/arm: " Alistair Francis
2017-09-30  2:46   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-10-16 11:41   ` [Qemu-devel] " Thomas Huth
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 06/47] hw/block: " Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 07/47] hw/bt: " Alistair Francis
2017-10-01 14:06   ` Thomas Huth [this message]
2017-10-17 18:32     ` Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 08/47] hw/char: " Alistair Francis
2017-10-01 14:09   ` Thomas Huth
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 09/47] hw/core: " Alistair Francis
2017-10-01  1:56   ` Philippe Mathieu-Daudé
2017-10-01 14:11   ` Thomas Huth
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 10/47] hw/cris: " Alistair Francis
2017-10-01 14:13   ` Thomas Huth
2017-10-16 11:42     ` Thomas Huth
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 11/47] hw/display: " Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 12/47] hw/dma: " Alistair Francis
2017-10-01  1:55   ` Philippe Mathieu-Daudé
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 13/47] hw/gpio: " Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 14/47] hw/i2c: " Alistair Francis
2017-10-01  1:52   ` Philippe Mathieu-Daudé
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 16/47] hw/ide: " Alistair Francis
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 17/47] hw/input: " Alistair Francis
2017-10-16 11:43   ` Thomas Huth
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 18/47] hw/intc: " Alistair Francis
2017-10-04  7:34   ` Cornelia Huck
2017-09-30  0:15 ` [Qemu-devel] [PATCH v2 19/47] hw/ipmi: " Alistair Francis
2017-10-01  1:50   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 20/47] hw/isa: " Alistair Francis
2017-10-01  1:48   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 21/47] hw/lm32: " Alistair Francis
2017-10-01  1:48   ` Philippe Mathieu-Daudé
2017-10-16 11:45   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 22/47] hw/m68k: " Alistair Francis
2017-09-30  6:42   ` Thomas Huth
2017-10-16 11:25   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 23/47] hw/microblaze: " Alistair Francis
2017-09-30  2:43   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 24/47] hw/mips: " Alistair Francis
2017-09-30  2:36   ` Philippe Mathieu-Daudé
2017-10-16 11:46   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 25/47] hw/misc: " Alistair Francis
2017-10-01  1:47   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 26/47] hw/moxie: " Alistair Francis
2017-10-01  1:46   ` Philippe Mathieu-Daudé
2017-10-16 11:47   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 27/47] hw/net: " Alistair Francis
2017-10-01  1:46   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 28/47] hw/nios2: " Alistair Francis
2017-09-30  2:39   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 29/47] hw/nvram: " Alistair Francis
2017-09-30  6:50   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 30/47] hw/openrisc: " Alistair Francis
2017-09-30 19:05   ` Stafford Horne
2017-10-16 11:50   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 31/47] hw/pci*: " Alistair Francis
2017-10-01  1:43   ` Philippe Mathieu-Daudé
2017-10-01  8:11   ` Marcel Apfelbaum
2017-10-02 18:15     ` Alistair Francis
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 32/47] hw/ppc: " Alistair Francis
2017-10-04  6:11   ` David Gibson
2017-10-16 11:53   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 33/47] hw/s390x: " Alistair Francis
2017-10-16 11:55   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 34/47] hw/scsi: " Alistair Francis
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 35/47] hw/sd: " Alistair Francis
2017-10-01  1:41   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 36/47] hw/sh4: " Alistair Francis
2017-10-16 11:56   ` Thomas Huth
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 37/47] hw/sparc*: " Alistair Francis
2017-09-30  2:40   ` Philippe Mathieu-Daudé
2017-09-30  0:16 ` [Qemu-devel] [PATCH v2 38/47] hw/ssi: " Alistair Francis
2017-10-01  1:38   ` Philippe Mathieu-Daudé
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 39/47] hw/timer: " Alistair Francis
2017-10-01  1:37   ` Philippe Mathieu-Daudé
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 40/47] hw/usb: " Alistair Francis
2017-10-01  1:36   ` Philippe Mathieu-Daudé
2017-10-01 14:16     ` Thomas Huth
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 41/47] hw/watchdog: " Alistair Francis
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 42/47] hw/xen*: " Alistair Francis
2017-10-10 15:13   ` Anthony PERARD
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 43/47] util: " Alistair Francis
2017-09-30  2:43   ` Philippe Mathieu-Daudé
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 44/47] ui: " Alistair Francis
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 45/47] tcg: " Alistair Francis
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 46/47] target: Use qemu_log() instead of fprintf(stderr, ...) Alistair Francis
2017-09-30  0:17 ` [Qemu-devel] [PATCH v2 47/47] target: Replace fprintf(stderr, "*\n" with error_report() Alistair Francis
2017-10-04  7:41   ` Cornelia Huck
     [not found] ` <ade26715c9bde1fe921959823de08da582fce58f.1506730372.git.alistair.francis@xilinx.com>
2017-10-10 14:51   ` [Qemu-devel] [PATCH v2 15/47] hw/i386: " Anthony PERARD

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=6ca0c9fa-0e28-cd41-70d6-aedfc23055d6@redhat.com \
    --to=thuth@redhat.com \
    --cc=alistair.francis@xilinx.com \
    --cc=alistair23@gmail.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).