diff mbox

v4l-utils: mc_nextgen_test fix compile warnings

Message ID 1449876481-5624-1-git-send-email-shuahkh@osg.samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Shuah Khan Dec. 11, 2015, 11:28 p.m. UTC
Fix the following compile warnings:

  CC       mc_nextgen_test-mc_nextgen_test.o
mc_nextgen_test.c: In function ‘media_get_ifname’:
mc_nextgen_test.c:410:3: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
   asprintf(&name, "%s", devname);
   ^
mc_nextgen_test.c: In function ‘media_get_ifname_udev’:
mc_nextgen_test.c:335:4: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
    asprintf(&name, "%s", p);
    ^
mc_nextgen_test.c: In function ‘objname’:
mc_nextgen_test.c:249:2: warning: ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
  asprintf(&name, "%s%c%d", gobj_type(id), delimiter, media_localid(id));
  ^

Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
---
 contrib/test/mc_nextgen_test.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
diff mbox

Patch

diff --git a/contrib/test/mc_nextgen_test.c b/contrib/test/mc_nextgen_test.c
index 743ddee..cf71bec 100644
--- a/contrib/test/mc_nextgen_test.c
+++ b/contrib/test/mc_nextgen_test.c
@@ -246,7 +246,11 @@  static inline const char *ent_function(uint32_t function)
 static char *objname(uint32_t id, char delimiter)
 {
 	char *name;
-	asprintf(&name, "%s%c%d", gobj_type(id), delimiter, media_localid(id));
+	int ret;
+
+	ret = asprintf(&name, "%s%c%d", gobj_type(id), delimiter, media_localid(id));
+	if (ret < 0)
+		return NULL;
 
 	return name;
 }
@@ -323,6 +327,7 @@  static char *media_get_ifname_udev(struct media_v2_intf_devnode *devnode, struct
 	dev_t devnum;
 	const char *p;
 	char *name = NULL;
+	int ret;
 
 	if (udev == NULL)
 		return NULL;
@@ -332,7 +337,9 @@  static char *media_get_ifname_udev(struct media_v2_intf_devnode *devnode, struct
 	if (device) {
 		p = udev_device_get_devnode(device);
 		if (p) {
-			asprintf(&name, "%s", p);
+			ret = asprintf(&name, "%s", p);
+			if (ret < 0)
+				return NULL;
 		}
 	}
 
@@ -406,9 +413,11 @@  char *media_get_ifname(struct media_v2_interface *intf, void *priv)
 	 * libudev.
 	 */
 	if (major(devstat.st_rdev) == intf->devnode.major &&
-	    minor(devstat.st_rdev) == intf->devnode.minor)
-		asprintf(&name, "%s", devname);
-
+	    minor(devstat.st_rdev) == intf->devnode.minor) {
+		ret = asprintf(&name, "%s", devname);
+		if (ret < 0)
+			return NULL;
+	}
 	return name;
 }