aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/stm
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2018-10-05 08:43:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-11 06:12:55 -0400
commita23bbec205b9b9b5f75af1811fe89d0598104b88 (patch)
tree310a69b69f7d089966e877b3b1f28b00d0f195ca /drivers/hwtracing/stm
parentce76d938dd98817f998c905e01fbb99b072c0bf6 (diff)
stm class: Use memcat_p()
Instead of a local copy, use the memcat_p() helper to merge policy node attributes. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Tested-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hwtracing/stm')
-rw-r--r--drivers/hwtracing/stm/policy.c29
1 files changed, 1 insertions, 28 deletions
diff --git a/drivers/hwtracing/stm/policy.c b/drivers/hwtracing/stm/policy.c
index 5e51bed0787b..0910ec807187 100644
--- a/drivers/hwtracing/stm/policy.c
+++ b/drivers/hwtracing/stm/policy.c
@@ -202,33 +202,6 @@ static struct configfs_attribute *stp_policy_node_attrs[] = {
202static const struct config_item_type stp_policy_type; 202static const struct config_item_type stp_policy_type;
203static const struct config_item_type stp_policy_node_type; 203static const struct config_item_type stp_policy_node_type;
204 204
205/* lifted from arch/x86/events/core.c */
206static struct configfs_attribute **merge_attr(struct configfs_attribute **a, struct configfs_attribute **b)
207{
208 struct configfs_attribute **new;
209 int j, i;
210
211 for (j = 0; a[j]; j++)
212 ;
213 for (i = 0; b[i]; i++)
214 j++;
215 j++;
216
217 new = kmalloc_array(j, sizeof(struct configfs_attribute *),
218 GFP_KERNEL);
219 if (!new)
220 return NULL;
221
222 j = 0;
223 for (i = 0; a[i]; i++)
224 new[j++] = a[i];
225 for (i = 0; b[i]; i++)
226 new[j++] = b[i];
227 new[j] = NULL;
228
229 return new;
230}
231
232const struct config_item_type * 205const struct config_item_type *
233get_policy_node_type(struct configfs_attribute **attrs) 206get_policy_node_type(struct configfs_attribute **attrs)
234{ 207{
@@ -240,7 +213,7 @@ get_policy_node_type(struct configfs_attribute **attrs)
240 if (!type) 213 if (!type)
241 return NULL; 214 return NULL;
242 215
243 merged = merge_attr(stp_policy_node_attrs, attrs); 216 merged = memcat_p(stp_policy_node_attrs, attrs);
244 if (!merged) { 217 if (!merged) {
245 kfree(type); 218 kfree(type);
246 return NULL; 219 return NULL;