.. | .. |
---|
42 | 42 | #include <rdma/ib_cache.h> |
---|
43 | 43 | #include "sa.h" |
---|
44 | 44 | |
---|
45 | | -static void mcast_add_one(struct ib_device *device); |
---|
| 45 | +static int mcast_add_one(struct ib_device *device); |
---|
46 | 46 | static void mcast_remove_one(struct ib_device *device, void *client_data); |
---|
47 | 47 | |
---|
48 | 48 | static struct ib_client mcast_client = { |
---|
.. | .. |
---|
71 | 71 | struct ib_event_handler event_handler; |
---|
72 | 72 | int start_port; |
---|
73 | 73 | int end_port; |
---|
74 | | - struct mcast_port port[0]; |
---|
| 74 | + struct mcast_port port[]; |
---|
75 | 75 | }; |
---|
76 | 76 | |
---|
77 | 77 | enum mcast_state { |
---|
.. | .. |
---|
804 | 804 | switch (event->event) { |
---|
805 | 805 | case IB_EVENT_PORT_ERR: |
---|
806 | 806 | case IB_EVENT_LID_CHANGE: |
---|
807 | | - case IB_EVENT_SM_CHANGE: |
---|
808 | 807 | case IB_EVENT_CLIENT_REREGISTER: |
---|
809 | 808 | mcast_groups_event(&dev->port[index], MCAST_GROUP_ERROR); |
---|
810 | 809 | break; |
---|
.. | .. |
---|
816 | 815 | } |
---|
817 | 816 | } |
---|
818 | 817 | |
---|
819 | | -static void mcast_add_one(struct ib_device *device) |
---|
| 818 | +static int mcast_add_one(struct ib_device *device) |
---|
820 | 819 | { |
---|
821 | 820 | struct mcast_device *dev; |
---|
822 | 821 | struct mcast_port *port; |
---|
.. | .. |
---|
826 | 825 | dev = kmalloc(struct_size(dev, port, device->phys_port_cnt), |
---|
827 | 826 | GFP_KERNEL); |
---|
828 | 827 | if (!dev) |
---|
829 | | - return; |
---|
| 828 | + return -ENOMEM; |
---|
830 | 829 | |
---|
831 | 830 | dev->start_port = rdma_start_port(device); |
---|
832 | 831 | dev->end_port = rdma_end_port(device); |
---|
.. | .. |
---|
846 | 845 | |
---|
847 | 846 | if (!count) { |
---|
848 | 847 | kfree(dev); |
---|
849 | | - return; |
---|
| 848 | + return -EOPNOTSUPP; |
---|
850 | 849 | } |
---|
851 | 850 | |
---|
852 | 851 | dev->device = device; |
---|
.. | .. |
---|
854 | 853 | |
---|
855 | 854 | INIT_IB_EVENT_HANDLER(&dev->event_handler, device, mcast_event_handler); |
---|
856 | 855 | ib_register_event_handler(&dev->event_handler); |
---|
| 856 | + return 0; |
---|
857 | 857 | } |
---|
858 | 858 | |
---|
859 | 859 | static void mcast_remove_one(struct ib_device *device, void *client_data) |
---|
.. | .. |
---|
861 | 861 | struct mcast_device *dev = client_data; |
---|
862 | 862 | struct mcast_port *port; |
---|
863 | 863 | int i; |
---|
864 | | - |
---|
865 | | - if (!dev) |
---|
866 | | - return; |
---|
867 | 864 | |
---|
868 | 865 | ib_unregister_event_handler(&dev->event_handler); |
---|
869 | 866 | flush_workqueue(mcast_wq); |
---|