]> git.baikalelectronics.ru Git - kernel.git/commit
component: Detach components when deleting master struct
authorJon Medhurst (Tixy) <tixy@linaro.org>
Tue, 26 Jan 2016 17:59:13 +0000 (17:59 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 27 Jan 2016 19:07:51 +0000 (19:07 +0000)
commitd40b92f6c7308ad2bc6f8e56d06b9ecaf64eb784
treecd79993b4871964d8d8bef8206dde643d9c55c27
parent578d877f78c517a58d305edb9b3ba096d2a1d5e2
component: Detach components when deleting master struct

component_master_add_with_match calls find_components which, if any
components already exist, it attaches to the master struct. However, if
we later encounter an error the master struct is deleted, leaving
components with a dangling pointer to it.

If the error was a temporary one, e.g. for probe deferral, then when
the master device is re-probed, it will fail to find the required
components as they appear to already be attached to a master.

Fix this by nulling components pointers to the master struct when it is
deleted. This code is factored out into a separate function so it can be
shared with component_master_del.

Signed-off-by: Jon Medhurst <tixy@linaro.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/base/component.c