Re: efi/apple-properties: Checking error handling in unmarshal_devices()
> While the allocator does print an error when allocations fail, > it may not be immediately apparent to the user what the > *consequences* are. In this case, the consequence is that the > device properties will not be available for consumption by > drivers and they may fail to probe or behave in entirely > unexpected ways. Would it make sense to indicate such a questionable software situation be any return code? > Hence I deliberately printed an error message here so that the user > can make the connection between erratic behavior of drivers later on > and the memory allocation error here. Do you find this terse message really sufficient? Can the mentioned properties be required for the desired system configuration? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] efi/apple-properties: Delete an error message for a failed memory allocation in unmarshal_devices()
From: Markus Elfring Date: Tue, 13 Feb 2018 17:52:10 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/firmware/efi/apple-properties.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi/apple-properties.c index 9f6bcf173b0e..f5f3159df4d5 100644 --- a/drivers/firmware/efi/apple-properties.c +++ b/drivers/firmware/efi/apple-properties.c @@ -158,10 +158,8 @@ static int __init unmarshal_devices(struct properties_header *properties) entry = kcalloc(dev_header->prop_count + 1, sizeof(*entry), GFP_KERNEL); - if (!entry) { - dev_err(dev, "cannot allocate properties\n"); + if (!entry) goto skip_device; - } unmarshal_key_value_pairs(dev_header, dev, ptr, entry); if (!entry[0].name) -- 2.16.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] efi: Delete an error message for a failed memory allocation in efivar_init()
From: Markus Elfring Date: Tue, 13 Feb 2018 17:28:22 +0100 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/firmware/efi/vars.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/firmware/efi/vars.c b/drivers/firmware/efi/vars.c index 9336ffdf6e2c..ffdbc5bc3c56 100644 --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -437,10 +437,8 @@ int efivar_init(int (*func)(efi_char16_t *, efi_guid_t, unsigned long, void *), int err = 0; variable_name = kzalloc(variable_name_size, GFP_KERNEL); - if (!variable_name) { - printk(KERN_ERR "efivars: Memory allocation failed.\n"); + if (!variable_name) return -ENOMEM; - } if (down_interruptible(&efivars_lock)) { err = -EINTR; -- 2.16.1 -- To unsubscribe from this list: send the line "unsubscribe linux-efi" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html