hw/bt: Replace fprintf(stderr, "*\n" with error_report()

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.

find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +
find ./* -type f -exec sed -i \
    'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \
    {} +

Some lines where then manually tweaked to pass checkpatch.

Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[THH: Changed one missing fprintf into an error_report, too]
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Alistair Francis 2017-11-08 14:56:46 -08:00 committed by Thomas Huth
parent c94a60cbfa
commit bf937a7965
6 changed files with 65 additions and 67 deletions

View file

@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
#include "qemu/error-report.h"
#include "qemu-common.h"
#include "qemu/timer.h"
#include "qemu/bswap.h"
@ -467,8 +468,8 @@ static void l2cap_channel_close(struct l2cap_instance_s *l2cap,
if (likely(ch)) {
if (ch->remote_cid != source_cid) {
fprintf(stderr, "%s: Ignoring a Disconnection Request with the "
"invalid SCID %04x.\n", __func__, source_cid);
error_report("%s: Ignoring a Disconnection Request with the "
"invalid SCID %04x.", __func__, source_cid);
return;
}
@ -790,7 +791,7 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
#if 0
/* TODO: do the IDs really have to be in sequence? */
if (!id || (id != l2cap->last_id && id != l2cap->next_id)) {
fprintf(stderr, "%s: out of sequence command packet ignored.\n",
error_report("%s: out of sequence command packet ignored.",
__func__);
return;
}
@ -813,9 +814,9 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
}
/* We never issue commands other than Command Reject currently. */
fprintf(stderr, "%s: stray Command Reject (%02x, %04x) "
"packet, ignoring.\n", __func__, id,
le16_to_cpu(((l2cap_cmd_rej *) params)->reason));
error_report("%s: stray Command Reject (%02x, %04x) "
"packet, ignoring.", __func__, id,
le16_to_cpu(((l2cap_cmd_rej *) params)->reason));
break;
case L2CAP_CONN_REQ:
@ -836,8 +837,8 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
}
/* We never issue Connection Requests currently. TODO */
fprintf(stderr, "%s: unexpected Connection Response (%02x) "
"packet, ignoring.\n", __func__, id);
error_report("%s: unexpected Connection Response (%02x) "
"packet, ignoring.", __func__, id);
break;
case L2CAP_CONF_REQ:
@ -865,8 +866,8 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
le16_to_cpu(((l2cap_conf_rsp *) params)->scid),
((l2cap_conf_rsp *) params)->data,
len - L2CAP_CONF_RSP_SIZE(0)))
fprintf(stderr, "%s: unexpected Configure Response (%02x) "
"packet, ignoring.\n", __func__, id);
error_report("%s: unexpected Configure Response (%02x) "
"packet, ignoring.", __func__, id);
break;
case L2CAP_DISCONN_REQ:
@ -887,8 +888,8 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
}
/* We never issue Disconnection Requests currently. TODO */
fprintf(stderr, "%s: unexpected Disconnection Response (%02x) "
"packet, ignoring.\n", __func__, id);
error_report("%s: unexpected Disconnection Response (%02x) "
"packet, ignoring.", __func__, id);
break;
case L2CAP_ECHO_REQ:
@ -897,8 +898,8 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
case L2CAP_ECHO_RSP:
/* We never issue Echo Requests currently. TODO */
fprintf(stderr, "%s: unexpected Echo Response (%02x) "
"packet, ignoring.\n", __func__, id);
error_report("%s: unexpected Echo Response (%02x) "
"packet, ignoring.", __func__, id);
break;
case L2CAP_INFO_REQ:
@ -917,8 +918,8 @@ static void l2cap_command(struct l2cap_instance_s *l2cap, int code, int id,
}
/* We never issue Information Requests currently. TODO */
fprintf(stderr, "%s: unexpected Information Response (%02x) "
"packet, ignoring.\n", __func__, id);
error_report("%s: unexpected Information Response (%02x) "
"packet, ignoring.", __func__, id);
break;
default:
@ -1066,8 +1067,8 @@ static void l2cap_frame_in(struct l2cap_instance_s *l2cap,
uint16_t len = le16_to_cpu(frame->len);
if (unlikely(cid >= L2CAP_CID_MAX || !l2cap->cid[cid])) {
fprintf(stderr, "%s: frame addressed to a non-existent L2CAP "
"channel %04x received.\n", __func__, cid);
error_report("%s: frame addressed to a non-existent L2CAP "
"channel %04x received.", __func__, cid);
return;
}
@ -1128,9 +1129,9 @@ static uint8_t *l2cap_bframe_out(struct bt_l2cap_conn_params_s *parm, int len)
struct l2cap_chan_s *chan = (struct l2cap_chan_s *) parm;
if (len > chan->params.remote_mtu) {
fprintf(stderr, "%s: B-Frame for CID %04x longer than %i octets.\n",
__func__,
chan->remote_cid, chan->params.remote_mtu);
error_report("%s: B-Frame for CID %04x longer than %i octets.",
__func__,
chan->remote_cid, chan->params.remote_mtu);
exit(-1);
}
@ -1353,8 +1354,8 @@ void bt_l2cap_psm_register(struct bt_l2cap_device_s *dev, int psm, int min_mtu,
struct bt_l2cap_psm_s *new_psm = l2cap_psm(dev, psm);
if (new_psm) {
fprintf(stderr, "%s: PSM %04x already registered for device `%s'.\n",
__func__, psm, dev->device.lmp_name);
error_report("%s: PSM %04x already registered for device `%s'.",
__func__, psm, dev->device.lmp_name);
exit(-1);
}