lkml.org 
[lkml]   [2006]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Pcihpd-discuss] [patch] pci hotplug: add common acpi functions to core
From
Date
On Wed, 2006-03-01 at 11:03 +0900, Kenji Kaneshige wrote:
> Hi Kristen,
>
> This looks very nice to me!
>
> Here is one comment.
>
> > +int is_root_bridge(acpi_handle handle)
> > +{
> > + acpi_status status;
> > + struct acpi_device_info *info;
> > + struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
> > + int i;
> > +
> > + status = acpi_get_object_info(handle, &buffer);
> > + if (ACPI_SUCCESS(status)) {
> > + info = buffer.pointer;
> > + if ((info->valid & ACPI_VALID_HID) &&
> > + !strcmp(PCI_ROOT_HID_STRING,
> > + info->hardware_id.value)) {
> > + acpi_os_free(buffer.pointer);
> > + return 1;
> > + }
> > + if (info->valid & ACPI_VALID_CID) {
> > + for (i=0; i < info->compatibility_id.count; i++) {
> > + if (!strcmp(PCI_ROOT_HID_STRING,
> > + info->compatibility_id.id[i].value)) {
> > + acpi_os_free(buffer.pointer);
> > + return 1;
> > + }
> > + }
> > + }
> > + }
> > + return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(is_root_bridge);
>
> I think this seems to leak memory (buffer.pointer), though
> I guess you just copy and paste from the original code. I think
> we need to free buffer.pointer whenever acpi_get_object_info()
> returns as success.
>
> Thanks,
> Kenji Kaneshige

Ah hah, you are right. Yes, I did just cut and paste the original code
- and this just makes me happy I'm doing this because this bug is
currently duplicated in 2 drivers since they all cut and pasted the same
buggy code. Soon we will just share the same 1 piece of buggy code.


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

\
 
 \ /
  Last update: 2006-03-01 23:53    [W:0.086 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site