Re: [Patch v5 4/7] acpi_memhotplug.c: free memory device if acpi_memory_enable_device() failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <rientjes@xxxxxxxxxx>
> CC: Jiang Liu <liuj97@xxxxxxxxx>
> CC: Len Brown <len.brown@xxxxxxxxx>
> CC: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>
> CC: Paul Mackerras <paulus@xxxxxxxxx>
> CC: Christoph Lameter <cl@xxxxxxxxx>
> Cc: Minchan Kim <minchan.kim@xxxxxxxxx>
> CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> CC: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> CC: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>
> CC: Rafael J. Wysocki <rjw@xxxxxxx>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
> Signed-off-by: Wen Congyang <wency@xxxxxxxxxxxxxx>
> ---

Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@xxxxxxxxxxxxxx>

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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]