[PATCH 4/9] backlight: Remove unnecessary and confusing NULL checks

Rob Bradford robert.bradford at intel.com
Wed Dec 5 10:47:06 PST 2012


From: Rob Bradford <rob at linux.intel.com>

At this point path must point to an allocated string since otherwise the
asprintf that makes the allocation would have failed and we would have
returned earlier.
---
 src/libbacklight.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/libbacklight.c b/src/libbacklight.c
index df811b4..2ac135a 100644
--- a/src/libbacklight.c
+++ b/src/libbacklight.c
@@ -69,8 +69,7 @@ static long backlight_get(struct backlight *backlight, char *node)
 	ret = value;
 out:
 	close(fd);
-	if (path)
-		free(path);
+	free(path);
 	return ret;
 }
 
@@ -127,8 +126,7 @@ long backlight_set_brightness(struct backlight *backlight, long brightness)
 out:
 	if (buffer)
 		free(buffer);
-	if (path)
-		free(path);
+	free(path);
 	close(fd);
 	return ret;
 }
-- 
1.7.11.7



More information about the wayland-devel mailing list