Re: [RFC PATCH 1/3] ACPIHP: introduce a framework for ACPI basedsystem device hotplug

From: Tang Chen
Date: Thu Aug 02 2012 - 03:05:10 EST


Hi,

A little problem here. :)

On 07/28/2012 07:42 PM, Jiang Liu wrote:
> +int acpihp_register_slot(struct acpihp_slot *slot)
> +{
> + int ret;
> + char *name;
> + size_t off;
> +
> + if (!slot || !slot->slot_ops)
> + return -EINVAL;
> +
> + /* Hook top level hotplug slots under ACPI root device */
> + if (slot->parent)
> + slot->dev.parent = &slot->parent->dev;
> + else
> + slot->dev.parent = &acpi_root->dev;
> +
> + ret = device_add(&slot->dev);
> + if (!ret) {
> + slot->flags |= ACPIHP_SLOT_FLAG_REGISTERED;
> + name = kmalloc(PAGE_SIZE, GFP_KERNEL);
> + if (name) {
> + off = acpihp_generate_link_name(slot, name, 0);
> + name[off - 1] = '\0';
> + sysfs_create_link(&acpihp_slot_kset->kobj,
> + &slot->dev.kobj, name);

I got a compiler warning here:
CC drivers/acpi/hotplug/core.o
drivers/acpi/hotplug/core.c: In function ‘acpihp_register_slot’:
drivers/acpi/hotplug/core.c:199: warning: ignoring return value of ‘sysfs_create_link’, declared with attribute warn_unused_result

Seems that we need to check the sysfs_create_link()'s return value here, and if it fails,
shall we at least give a warning message here ?

Thanks. :)


> + kfree(name);
> + }
> + }
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(acpihp_register_slot);

--
Best Regards,
Tang chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/