diff options
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 2bc43444841b..35d0d47e6f8c 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -889,9 +889,9 @@ static struct attribute *alloc_hsa_lifespan(char *name, u8 port_num) | |||
889 | static void setup_hw_stats(struct ib_device *device, struct ib_port *port, | 889 | static void setup_hw_stats(struct ib_device *device, struct ib_port *port, |
890 | u8 port_num) | 890 | u8 port_num) |
891 | { | 891 | { |
892 | struct attribute_group *hsag = NULL; | 892 | struct attribute_group *hsag; |
893 | struct rdma_hw_stats *stats; | 893 | struct rdma_hw_stats *stats; |
894 | int i = 0, ret; | 894 | int i, ret; |
895 | 895 | ||
896 | stats = device->alloc_hw_stats(device, port_num); | 896 | stats = device->alloc_hw_stats(device, port_num); |
897 | 897 | ||
@@ -914,7 +914,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, | |||
914 | ret = device->get_hw_stats(device, stats, port_num, | 914 | ret = device->get_hw_stats(device, stats, port_num, |
915 | stats->num_counters); | 915 | stats->num_counters); |
916 | if (ret != stats->num_counters) | 916 | if (ret != stats->num_counters) |
917 | goto err; | 917 | goto err_free_hsag; |
918 | 918 | ||
919 | stats->timestamp = jiffies; | 919 | stats->timestamp = jiffies; |
920 | 920 | ||
@@ -951,6 +951,7 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, | |||
951 | err: | 951 | err: |
952 | for (; i >= 0; i--) | 952 | for (; i >= 0; i--) |
953 | kfree(hsag->attrs[i]); | 953 | kfree(hsag->attrs[i]); |
954 | err_free_hsag: | ||
954 | kfree(hsag); | 955 | kfree(hsag); |
955 | err_free_stats: | 956 | err_free_stats: |
956 | kfree(stats); | 957 | kfree(stats); |