int efi_get_variable_string(sd_id128_t vendor, const char *name, char **p) {
_cleanup_free_ void *s = NULL;
- size_t ss;
+ size_t ss = 0;
int r;
char *x;
else if (s[i] >= 'A' && s[i] <= 'F')
id |= (s[i] - 'A' + 10) << (3 - i) * 4;
else
- return -1;
+ return -EINVAL;
return id;
}
static int read_usec(sd_id128_t vendor, const char *name, usec_t *u) {
_cleanup_free_ char *j = NULL;
int r;
- uint64_t x;
+ uint64_t x = 0;
assert(name);
assert(u);
int efi_loader_get_device_part_uuid(sd_id128_t *u) {
_cleanup_free_ char *p = NULL;
int r, parsed[16];
- unsigned i;
-
- assert(u);
r = efi_get_variable_string(EFI_VENDOR_LOADER, "LoaderDevicePartUUID", &p);
if (r < 0)
&parsed[12], &parsed[13], &parsed[14], &parsed[15]) != 16)
return -EIO;
- for (i = 0; i < ELEMENTSOF(parsed); i++)
- u->bytes[i] = parsed[i];
+ if (u) {
+ unsigned i;
+
+ for (i = 0; i < ELEMENTSOF(parsed); i++)
+ u->bytes[i] = parsed[i];
+ }
return 0;
}