host/trxcon: use LOGP instead of fprintf

There is no (performance) reason to use fprintf instead of LOGP.
Second one provides more useful information, such as a file name
and a line number.

Change-Id: I86dda5b3d746c7802442e4226578a06c04941721
This commit is contained in:
Vadim Yanitskiy 2017-08-19 12:15:15 +06:00
parent f979d44a72
commit 3641fe6123
2 changed files with 4 additions and 4 deletions

View File

@ -74,7 +74,7 @@ static int l1ctl_link_read_cb(struct osmo_fd *bfd)
msg = msgb_alloc_headroom(L1CTL_LENGTH + L1CTL_HEADROOM,
L1CTL_HEADROOM, "L1CTL");
if (!msg) {
fprintf(stderr, "Failed to allocate msg\n");
LOGP(DL1D, LOGL_ERROR, "Failed to allocate msg\n");
return -ENOMEM;
}
@ -236,7 +236,7 @@ int l1ctl_link_init(struct l1ctl_link **l1l, const char *sock_path)
l1l_new = talloc_zero(tall_trx_ctx, struct l1ctl_link);
if (!l1l_new) {
fprintf(stderr, "Failed to allocate memory\n");
LOGP(DL1C, LOGL_ERROR, "Failed to allocate memory\n");
return -ENOMEM;
}
@ -245,7 +245,7 @@ int l1ctl_link_init(struct l1ctl_link **l1l, const char *sock_path)
rc = osmo_sock_unix_init_ofd(bfd, SOCK_STREAM, 0, sock_path,
OSMO_SOCK_F_BIND);
if (rc < 0) {
fprintf(stderr, "Could not create UNIX socket: %s\n",
LOGP(DL1C, LOGL_ERROR, "Could not create UNIX socket: %s\n",
strerror(errno));
talloc_free(l1l_new);
return rc;

View File

@ -636,7 +636,7 @@ int trx_if_open(struct trx_instance **trx, const char *host, uint16_t port)
/* Try to allocate memory */
trx_new = talloc_zero(tall_trx_ctx, struct trx_instance);
if (!trx_new) {
fprintf(stderr, "Failed to allocate memory\n");
LOGP(DTRX, LOGL_ERROR, "Failed to allocate memory\n");
return -ENOMEM;
}