Re: [PATCH -V3 3/4] acpi, hmat: calculate abstract distance with HMAT

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

 



Alistair Popple <apopple@xxxxxxxxxx> writes:

> Thanks for making changes here, looks better to me at least.
>
> Huang Ying <ying.huang@xxxxxxxxx> writes:
>
>>  static __init void hmat_free_structures(void)
>>  {
>>  	struct memory_target *target, *tnext;
>> @@ -801,6 +857,7 @@ static __init int hmat_init(void)
>>  	struct acpi_table_header *tbl;
>>  	enum acpi_hmat_type i;
>>  	acpi_status status;
>> +	int usage;
>>  
>>  	if (srat_disabled() || hmat_disable)
>>  		return 0;
>> @@ -841,7 +898,10 @@ static __init int hmat_init(void)
>>  	hmat_register_targets();
>>  
>>  	/* Keep the table and structures if the notifier may use them */
>> -	if (!hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
>> +	usage = !hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI);
>> +	if (!hmat_set_default_dram_perf())
>> +		usage += !register_mt_adistance_algorithm(&hmat_adist_nb);
>> +	if (usage)
>>  		return 0;
>
> Can we simplify the error handling here? As I understand it
> hotplug_memory_notifier() and register_mt_adistance_algorithm() aren't
> expected to ever fail because hmat_init() should only be called once and
> the notifier register shouldn't fail. So wouldn't the below be
> effectively the same thing but clearer?
>
>     if (hotplug_memory_notifier(hmat_callback, HMAT_CALLBACK_PRI))
>         goto out_put;
>        
>     if (!hmat_set_default_dram_perf())
>         register_mt_adistance_algorithm(&hmat_adist_nb);
>
>     return 0;
>
>>  out_put:
>>  	hmat_free_structures();

Looks good to me!  Will do that in the next version!

> Also as an aside while looking at this patch I noticed a minor bug:
>
> 	status = acpi_get_table(ACPI_SIG_HMAT, 0, &tbl);
> 	if (ACPI_FAILURE(status))
> 		goto out_put;
>
> This will call acpi_put_table(tbl) even though we failed to get the
> table.

Thanks for pointing this out.  This should go through ACPI tree.  So
will not do this in a separate patch.

--
Best Regards,
Huang, Ying




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

  Powered by Linux