kmodloader: fix compilation warning with not checking return of asprintf
authorChristian Marangi <ansuelsmth@gmail.com>
Sun, 17 Jul 2022 00:59:32 +0000 (02:59 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Sun, 17 Jul 2022 00:59:32 +0000 (02:59 +0200)
commit46a33b8be298e1e700e56f05b5ba4f06daf83efa
tree361cddc2ab15141dda773db31735b50fa1836693
parentb87a4fdca6346a01c19e94fe0461fb9ef7493815
kmodloader: fix compilation warning with not checking return of asprintf

Fix the following compilation warning:

kmodloader.c: In function 'main_loader':
kmodloader.c:1027:41: error: ignoring return value of 'asprintf' declared with attribute 'warn_unused_result' [-Werror=unused-result]
make[1]: *** [package/Makefile:116: package/system/ubox/compile] Error 1
 1027 |                                         asprintf(&m->opts, "%s %s", prev, opts);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

While at it rework the function to not duplicate too much code with the
error handling.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
kmodloader.c