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 branch 'component' of git://ftp.arm.linux.org.uk/~rmk/linux-arm

Pull component helper fixes from Russell King:
"A few fixes for problems people have encountered with the recent
update to the component helpers"

* 'component' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
component: remove device from master match list on failed add
component: Detach components when deleting master struct
component: fix crash on x86_64 with hda audio drivers

+28 -21
+28 -21
drivers/base/component.c
··· 206 206 if (mc->release) 207 207 mc->release(master, mc->data); 208 208 } 209 + 210 + kfree(match->compare); 209 211 } 210 212 211 213 static void devm_component_match_release(struct device *dev, void *res) ··· 223 221 if (match->alloc == num) 224 222 return 0; 225 223 226 - new = devm_kmalloc_array(dev, num, sizeof(*new), GFP_KERNEL); 224 + new = kmalloc_array(num, sizeof(*new), GFP_KERNEL); 227 225 if (!new) 228 226 return -ENOMEM; 229 227 230 228 if (match->compare) { 231 229 memcpy(new, match->compare, sizeof(*new) * 232 230 min(match->num, num)); 233 - devm_kfree(dev, match->compare); 231 + kfree(match->compare); 234 232 } 235 233 match->compare = new; 236 234 match->alloc = num; ··· 285 283 } 286 284 EXPORT_SYMBOL(component_match_add_release); 287 285 286 + static void free_master(struct master *master) 287 + { 288 + struct component_match *match = master->match; 289 + int i; 290 + 291 + list_del(&master->node); 292 + 293 + if (match) { 294 + for (i = 0; i < match->num; i++) { 295 + struct component *c = match->compare[i].component; 296 + if (c) 297 + c->master = NULL; 298 + } 299 + } 300 + 301 + kfree(master); 302 + } 303 + 288 304 int component_master_add_with_match(struct device *dev, 289 305 const struct component_master_ops *ops, 290 306 struct component_match *match) ··· 329 309 330 310 ret = try_to_bring_up_master(master, NULL); 331 311 332 - if (ret < 0) { 333 - /* Delete off the list if we weren't successful */ 334 - list_del(&master->node); 335 - kfree(master); 336 - } 312 + if (ret < 0) 313 + free_master(master); 314 + 337 315 mutex_unlock(&component_mutex); 338 316 339 317 return ret < 0 ? ret : 0; ··· 342 324 const struct component_master_ops *ops) 343 325 { 344 326 struct master *master; 345 - int i; 346 327 347 328 mutex_lock(&component_mutex); 348 329 master = __master_find(dev, ops); 349 330 if (master) { 350 - struct component_match *match = master->match; 351 - 352 331 take_down_master(master); 353 - 354 - list_del(&master->node); 355 - 356 - if (match) { 357 - for (i = 0; i < match->num; i++) { 358 - struct component *c = match->compare[i].component; 359 - if (c) 360 - c->master = NULL; 361 - } 362 - } 363 - kfree(master); 332 + free_master(master); 364 333 } 365 334 mutex_unlock(&component_mutex); 366 335 } ··· 491 486 492 487 ret = try_to_bring_up_masters(component); 493 488 if (ret < 0) { 489 + if (component->master) 490 + remove_component(component->master, component); 494 491 list_del(&component->node); 495 492 496 493 kfree(component);