Re: [PATCH 3/5] of: Correct property name comparison in __of_add_property()

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

 



On 2025/2/25 22:38, Rob Herring wrote:
> On Mon, Feb 24, 2025 at 10:27:59PM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@xxxxxxxxxxx>
>>
>> __of_add_property() compares property name by strcmp(), and that is
>> improper for SPARC which wants strcasecmp().
> Except that 'name' is the nodename (usually, with a few rare 
> exceptions). Sparc node names are case sensitive, so strcmp was correct. 

Here, it is property's name and NOT node's name.

arch/sparc/include/asm/prom.h:

#define of_compat_cmp(s1, s2, l) strncmp((s1), (s2), (l))
#define of_prop_cmp(s1, s2)	strcasecmp((s1), (s2)) //SPARC HERE
#define of_node_cmp(s1, s2)	strcmp((s1), (s2))


include/linux/of.h:
/* Default string compare functions, Allow arch asm/prom.h to override */
#if !defined(of_compat_cmp)
#define of_compat_cmp(s1, s2, l) strcasecmp((s1), (s2))
#define of_prop_cmp(s1, s2)	strcmp((s1), (s2))      // others HERE
#define of_node_cmp(s1, s2)	strcasecmp((s1), (s2))
#endif

actually, later __of_update_property() and __of_find_property() use
of_prop_cmp() instead of strcmp() to compare property name.

perhaps, compatible and node name also have similar issues in current
OF codes.





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux