mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] fixup! base: add class device support
@ 2024-06-20 12:55 Ahmad Fatoum
  2024-06-20 12:55 ` [PATCH 2/2] fixup! net: register eth class Ahmad Fatoum
  2024-07-01 12:10 ` [PATCH 1/2] fixup! base: add class device support Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-06-20 12:55 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

base: class: fix class_remove_device to not corrupt the class list

class_remove_device is supposed to remove the device from the class, not
remove the class from its devices.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/base/class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 28ae828d658a..fd7d6b2d7a29 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -21,7 +21,7 @@ int class_add_device(struct class *class, struct device *dev)
 
 void class_remove_device(struct class *class, struct device *dev)
 {
-	list_del(&class->devices);
+	list_del(&dev->class_list);
 }
 
 extern struct class __barebox_class_start[];
-- 
2.39.2




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

* [PATCH 2/2] fixup! net: register eth class
  2024-06-20 12:55 [PATCH 1/2] fixup! base: add class device support Ahmad Fatoum
@ 2024-06-20 12:55 ` Ahmad Fatoum
  2024-07-01 12:10 ` [PATCH 1/2] fixup! base: add class device support Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-06-20 12:55 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

net: fix crash removing uninitiailized eth_device::list during shutdown

next currently crashes on barebox_shutdown(), because list is no longer
initialized after being replaced by classes.

Fixes: 27ed36df29b1 ("net: register eth class")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 include/net.h | 2 --
 net/eth.c     | 1 -
 2 files changed, 3 deletions(-)

diff --git a/include/net.h b/include/net.h
index 05d73e543f7e..a04ed5b0ab92 100644
--- a/include/net.h
+++ b/include/net.h
@@ -60,8 +60,6 @@ struct eth_device {
 	struct device *parent;
 	char *nodepath;
 
-	struct list_head list;
-
 	IPaddr_t ipaddr;
 	IPaddr_t netmask;
 	char ethaddr[6];
diff --git a/net/eth.c b/net/eth.c
index ce7d839ed113..7229530c055b 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -545,7 +545,6 @@ void eth_unregister(struct eth_device *edev)
 
 	unregister_device(&edev->dev);
 	slice_exit(&edev->slice);
-	list_del(&edev->list);
 }
 
 void led_trigger_network(enum led_trigger trigger)
-- 
2.39.2




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

* Re: [PATCH 1/2] fixup! base: add class device support
  2024-06-20 12:55 [PATCH 1/2] fixup! base: add class device support Ahmad Fatoum
  2024-06-20 12:55 ` [PATCH 2/2] fixup! net: register eth class Ahmad Fatoum
@ 2024-07-01 12:10 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-07-01 12:10 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 20 Jun 2024 14:55:47 +0200, Ahmad Fatoum wrote:
> base: class: fix class_remove_device to not corrupt the class list
> 
> class_remove_device is supposed to remove the device from the class, not
> remove the class from its devices.
> 
> 

Applied, thanks!

[1/2] fixup! base: add class device support
      https://git.pengutronix.de/cgit/barebox/commit/?id=f43bff7f39fd (link may not be stable)
[2/2] fixup! net: register eth class
      https://git.pengutronix.de/cgit/barebox/commit/?id=f4f7d0e3257c (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-07-01 12:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 12:55 [PATCH 1/2] fixup! base: add class device support Ahmad Fatoum
2024-06-20 12:55 ` [PATCH 2/2] fixup! net: register eth class Ahmad Fatoum
2024-07-01 12:10 ` [PATCH 1/2] fixup! base: add class device support Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox