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 <gnu...@cyberdimension.org>
---
 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;
 }
-- 
2.36.1

_______________________________________________
Replicant mailing list
Replicant@osuosl.org
https://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to