2012/11/15 15:59, Wen Congyang wrote: > If acpi_memory_enable_device() fails, acpi_memory_enable_device() will > return a non-zero value, which means we fail to bind the memory device to > this driver. So we should free memory device before > acpi_memory_device_add() returns. > > CC: David Rientjes <rient...@google.com> > CC: Jiang Liu <liu...@gmail.com> > CC: Len Brown <len.br...@intel.com> > CC: Benjamin Herrenschmidt <b...@kernel.crashing.org> > CC: Paul Mackerras <pau...@samba.org> > CC: Christoph Lameter <c...@linux.com> > Cc: Minchan Kim <minchan....@gmail.com> > CC: Andrew Morton <a...@linux-foundation.org> > CC: KOSAKI Motohiro <kosaki.motoh...@jp.fujitsu.com> > CC: Yasuaki Ishimatsu <isimatu.yasu...@jp.fujitsu.com> > CC: Rafael J. Wysocki <r...@sisk.pl> > CC: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> > Signed-off-by: Wen Congyang <we...@cn.fujitsu.com> > ---
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasu...@jp.fujitsu.com> Thanks, Yasuaki Ishimatsu > drivers/acpi/acpi_memhotplug.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c > index c5e7b6d..e52ad5d 100644 > --- a/drivers/acpi/acpi_memhotplug.c > +++ b/drivers/acpi/acpi_memhotplug.c > @@ -421,9 +421,11 @@ static int acpi_memory_device_add(struct acpi_device > *device) > if (!acpi_memory_check_device(mem_device)) { > /* call add_memory func */ > result = acpi_memory_enable_device(mem_device); > - if (result) > + if (result) { > printk(KERN_ERR PREFIX > "Error in acpi_memory_enable_device\n"); > + acpi_memory_device_free(mem_device); > + } > } > return result; > } > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/