All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] driver core: skip removal test for non-removable drivers
@ 2016-10-11 18:41 Rob Herring
  2016-10-11 18:41 ` [PATCH 2/2] driver core: fix smatch warning on dev->bus check Rob Herring
  2016-10-12  7:10 ` [PATCH 1/2] driver core: skip removal test for non-removable drivers Laszlo Ersek
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring @ 2016-10-11 18:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Laszlo Ersek

Some drivers do not support removal/unbinding. These drivers should have
drv->suppress_bind_attrs set to true, so use that to skip the removal
test.

This doesn't fix anything reported so far, but should prevent some other
cases. Some drivers will need fixes to set suppress_bind_attrs to avoid
this test.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177021
Fixes: bea5b158ff0d ("driver core: add test of driver remove calls during probe")
Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/base/dd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index d22a7260f42b..8937a7ad7165 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -324,7 +324,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 {
 	int ret = -EPROBE_DEFER;
 	int local_trigger_count = atomic_read(&deferred_trigger_count);
-	bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE);
+	bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
+			   !drv->suppress_bind_attrs;
 
 	if (defer_all_probes) {
 		/*
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] driver core: fix smatch warning on dev->bus check
  2016-10-11 18:41 [PATCH 1/2] driver core: skip removal test for non-removable drivers Rob Herring
@ 2016-10-11 18:41 ` Rob Herring
  2016-10-12  7:10 ` [PATCH 1/2] driver core: skip removal test for non-removable drivers Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Rob Herring @ 2016-10-11 18:41 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Dan Carpenter

Commit d42a09802174 (driver core: skip removal test for non-removable
drivers) introduced a smatch warning:

drivers/base/dd.c:386 really_probe()
         warn: variable dereferenced before check 'dev->bus' (see line 373)

Fix the warning by removing the dev->bus NULL check. dev->bus will never
be NULL, so the check was unnecessary.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rob Herring <robh@kernel.org>
---
 drivers/base/dd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 8937a7ad7165..d76cd97a98b6 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -384,7 +384,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
 	if (test_remove) {
 		test_remove = false;
 
-		if (dev->bus && dev->bus->remove)
+		if (dev->bus->remove)
 			dev->bus->remove(dev);
 		else if (drv->remove)
 			drv->remove(dev);
-- 
2.10.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] driver core: skip removal test for non-removable drivers
  2016-10-11 18:41 [PATCH 1/2] driver core: skip removal test for non-removable drivers Rob Herring
  2016-10-11 18:41 ` [PATCH 2/2] driver core: fix smatch warning on dev->bus check Rob Herring
@ 2016-10-12  7:10 ` Laszlo Ersek
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2016-10-12  7:10 UTC (permalink / raw)
  To: Rob Herring; +Cc: Greg Kroah-Hartman, linux-kernel

Hi Rob,

On 10/11/16 20:41, Rob Herring wrote:
> Some drivers do not support removal/unbinding. These drivers should have
> drv->suppress_bind_attrs set to true, so use that to skip the removal
> test.
> 
> This doesn't fix anything reported so far, but should prevent some other
> cases. Some drivers will need fixes to set suppress_bind_attrs to avoid
> this test.
> 
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=177021
> Fixes: bea5b158ff0d ("driver core: add test of driver remove calls during probe")
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
>  drivers/base/dd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/dd.c b/drivers/base/dd.c
> index d22a7260f42b..8937a7ad7165 100644
> --- a/drivers/base/dd.c
> +++ b/drivers/base/dd.c
> @@ -324,7 +324,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)
>  {
>  	int ret = -EPROBE_DEFER;
>  	int local_trigger_count = atomic_read(&deferred_trigger_count);
> -	bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE);
> +	bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
> +			   !drv->suppress_bind_attrs;
>  
>  	if (defer_all_probes) {
>  		/*
> 

can you please repost the full series with me CC'd on all of the
messages; I'm not subscribed to LKML.

Thanks,
Laszlo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-12  7:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-11 18:41 [PATCH 1/2] driver core: skip removal test for non-removable drivers Rob Herring
2016-10-11 18:41 ` [PATCH 2/2] driver core: fix smatch warning on dev->bus check Rob Herring
2016-10-12  7:10 ` [PATCH 1/2] driver core: skip removal test for non-removable drivers Laszlo Ersek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.