hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/infiniband/core/multicast.c
....@@ -42,7 +42,7 @@
4242 #include <rdma/ib_cache.h>
4343 #include "sa.h"
4444
45
-static void mcast_add_one(struct ib_device *device);
45
+static int mcast_add_one(struct ib_device *device);
4646 static void mcast_remove_one(struct ib_device *device, void *client_data);
4747
4848 static struct ib_client mcast_client = {
....@@ -71,7 +71,7 @@
7171 struct ib_event_handler event_handler;
7272 int start_port;
7373 int end_port;
74
- struct mcast_port port[0];
74
+ struct mcast_port port[];
7575 };
7676
7777 enum mcast_state {
....@@ -804,7 +804,6 @@
804804 switch (event->event) {
805805 case IB_EVENT_PORT_ERR:
806806 case IB_EVENT_LID_CHANGE:
807
- case IB_EVENT_SM_CHANGE:
808807 case IB_EVENT_CLIENT_REREGISTER:
809808 mcast_groups_event(&dev->port[index], MCAST_GROUP_ERROR);
810809 break;
....@@ -816,7 +815,7 @@
816815 }
817816 }
818817
819
-static void mcast_add_one(struct ib_device *device)
818
+static int mcast_add_one(struct ib_device *device)
820819 {
821820 struct mcast_device *dev;
822821 struct mcast_port *port;
....@@ -826,7 +825,7 @@
826825 dev = kmalloc(struct_size(dev, port, device->phys_port_cnt),
827826 GFP_KERNEL);
828827 if (!dev)
829
- return;
828
+ return -ENOMEM;
830829
831830 dev->start_port = rdma_start_port(device);
832831 dev->end_port = rdma_end_port(device);
....@@ -846,7 +845,7 @@
846845
847846 if (!count) {
848847 kfree(dev);
849
- return;
848
+ return -EOPNOTSUPP;
850849 }
851850
852851 dev->device = device;
....@@ -854,6 +853,7 @@
854853
855854 INIT_IB_EVENT_HANDLER(&dev->event_handler, device, mcast_event_handler);
856855 ib_register_event_handler(&dev->event_handler);
856
+ return 0;
857857 }
858858
859859 static void mcast_remove_one(struct ib_device *device, void *client_data)
....@@ -861,9 +861,6 @@
861861 struct mcast_device *dev = client_data;
862862 struct mcast_port *port;
863863 int i;
864
-
865
- if (!dev)
866
- return;
867864
868865 ib_unregister_event_handler(&dev->event_handler);
869866 flush_workqueue(mcast_wq);