backlight: Jump to cleanup code if synthesizing backlight string fails
This applies the same pattern as used in other error cases in this block - and cleans up the file desciptors and allocated memory too. Signed-off-by: Rob Bradford <rob@linux.intel.com>
This commit is contained in:
committed by
Kristian Høgsberg
parent
6b6795f070
commit
a6b63d0f67
+4
-2
@@ -111,8 +111,10 @@ long backlight_set_brightness(struct backlight *backlight, long brightness)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asprintf(&buffer, "%ld", brightness) < 0)
|
if (asprintf(&buffer, "%ld", brightness) < 0) {
|
||||||
return -ENOMEM;
|
ret = -1;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
ret = write(fd, buffer, strlen(buffer));
|
ret = write(fd, buffer, strlen(buffer));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user