lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 21 Apr 2020 12:06:18 +0800
From:   Dilip Kota <eswara.kota@...ux.intel.com>
To:     Lee Jones <lee.jones@...aro.org>
Cc:     linux-kernel@...r.kernel.org, kishon@...com,
        devicetree@...r.kernel.org, arnd@...db.de, robh@...nel.org,
        andriy.shevchenko@...el.com, cheol.yong.kim@...el.com,
        chuanhua.lei@...ux.intel.com, qi-ming.wu@...el.com,
        yixin.zhu@...el.com
Subject: Re: [RESEND PATCH v6 1/4] mfd: syscon: Add fwnode_to_regmap


On 4/17/2020 5:35 PM, Lee Jones wrote:
> On Mon, 06 Apr 2020, Dilip Kota wrote:
>
>> Traverse regmap handle entry from firmware node handle.
>>
>> Signed-off-by: Dilip Kota <eswara.kota@...ux.intel.com>
>> ---
>> Changes on v5:
>>    No changes
>>    
>> Changes on v5:
>>    No changes
>>
>> Changes on v4:
>>    No changes
>>
>>   drivers/mfd/syscon.c       | 8 ++++++++
>>   include/linux/mfd/syscon.h | 6 ++++++
>>   2 files changed, 14 insertions(+)
>>
>> diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
>> index 3a97816d0cba..e085c50816b9 100644
>> --- a/drivers/mfd/syscon.c
>> +++ b/drivers/mfd/syscon.c
>> @@ -178,6 +178,14 @@ struct regmap *device_node_to_regmap(struct device_node *np)
>>   }
>>   EXPORT_SYMBOL_GPL(device_node_to_regmap);
>>   
>> +struct regmap *fwnode_to_regmap(struct fwnode_handle *fwnode)
>> +{
>> +	struct device_node *np = to_of_node(fwnode);
> You are assuming that the fwnode was Device Tree pointer.
>
> The point of a fwnode is that it could be one of multiple types.
>
> What if it was a pointer to an ACPI property?
Yes, i missed to check in other perspective. Thanks for pointing it.
While going through the System control driver to address the query, i 
noticed that System Control
driver is talking with 'of' framework only. (No ACPI)

So, i think to add a defensive check and return error pointer if 
'to_of_node' returns NULL
As System control Driver cannot talk with ACPI, so fwnode_to_regmap() 
cannot talk and return error.

Or, the other option is removing the 'fwnode_to_regmap()' definition 
itself, to avoid confusion as fwnode can
point to 'OF', 'ACPI'or 'swnode'.

But, i feel return error for ACPI or oother, looks better because 
'device_node' has fwnode pointer. And provide description
in the header file, mentioning function is success for 'OF' and returns 
error for the rest.

Regards,
Dilip

>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ