Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux

Pull fix to common clk framework from Michael Turquette:
"The previous set of common clk fixes for -rc5 left an uninitialized
int which could lead to bad array indexing when switching clock
parents. The issue is fixed with a trivial change to the code flow in
__clk_set_parent."

* tag 'clk-fixes-for-linus' of git://git.linaro.org/people/mturquette/linux:
clk: fix parent validation in __clk_set_parent()

+13 -15
+13 -15
drivers/clk/clk.c
··· 1067 1067 1068 1068 old_parent = clk->parent; 1069 1069 1070 - /* find index of new parent clock using cached parent ptrs */ 1071 - if (clk->parents) 1072 - for (i = 0; i < clk->num_parents; i++) 1073 - if (clk->parents[i] == parent) 1074 - break; 1075 - else 1070 + if (!clk->parents) 1076 1071 clk->parents = kzalloc((sizeof(struct clk*) * clk->num_parents), 1077 1072 GFP_KERNEL); 1078 1073 1079 1074 /* 1080 - * find index of new parent clock using string name comparison 1081 - * also try to cache the parent to avoid future calls to __clk_lookup 1075 + * find index of new parent clock using cached parent ptrs, 1076 + * or if not yet cached, use string name comparison and cache 1077 + * them now to avoid future calls to __clk_lookup. 1082 1078 */ 1083 - if (i == clk->num_parents) 1084 - for (i = 0; i < clk->num_parents; i++) 1085 - if (!strcmp(clk->parent_names[i], parent->name)) { 1086 - if (clk->parents) 1087 - clk->parents[i] = __clk_lookup(parent->name); 1088 - break; 1089 - } 1079 + for (i = 0; i < clk->num_parents; i++) { 1080 + if (clk->parents && clk->parents[i] == parent) 1081 + break; 1082 + else if (!strcmp(clk->parent_names[i], parent->name)) { 1083 + if (clk->parents) 1084 + clk->parents[i] = __clk_lookup(parent->name); 1085 + break; 1086 + } 1087 + } 1090 1088 1091 1089 if (i == clk->num_parents) { 1092 1090 pr_debug("%s: clock %s is not a possible parent of clock %s\n",