From 4412cad28a7619330f83974a15d512e5c37e8eb5 Mon Sep 17 00:00:00 2001 From: Denis 'GNUtoo' Carikli Date: Tue, 14 Jun 2022 05:12:59 +0200 Subject: crespo_gprs_get_iface_single: handle asprintf errors Without that fix we have the following warning: ../../../samsung-ipc/devices/crespo/crespo.c: In function 'crespo_gprs_get_iface_single': ../../../samsung-ipc/devices/crespo/crespo.c:562:9: warning: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Wunused-result] 562 | asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Denis 'GNUtoo' Carikli --- samsung-ipc/devices/crespo/crespo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c index ebb6075..27e1dd5 100644 --- a/samsung-ipc/devices/crespo/crespo.c +++ b/samsung-ipc/devices/crespo/crespo.c @@ -553,13 +553,17 @@ int crespo_gprs_deactivate(__attribute__((unused)) struct ipc_client *client, return 0; } -char *crespo_gprs_get_iface_single( - __attribute__((unused)) struct ipc_client *client, - __attribute__((unused)) unsigned int cid) +char *crespo_gprs_get_iface_single(struct ipc_client *client, + __attribute__((unused)) unsigned int cid) { char *iface = NULL; + int rc; - asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0); + rc = asprintf(&iface, "%s%d", CRESPO_GPRS_IFACE_PREFIX, 0); + if (rc == -1) { + ipc_client_log(client, "%s: asprintf failed", __func__); + return NULL; + } return iface; } -- cgit v1.2.3