Remove debug prints after allocation failure
Subsystems (9)
cover Remove debug prints after allocation failure
Hi Doug and all,
This is semantic cleanup of infiniband stack from printks immediately after allocation failure. It doesn't get rid from all printks, but only from the ones which were found by the following grep construction.
➜ linux-rdma git:(topic/clean-alloc-prints) grep -rI "[k|v][m|z|c]alloc(" drivers/infiniband/* -A5 | grep "n\""
The patchset consists from the 16 almost identical patches and from one fix which was discovered during the cleanup work.
The fix is presented in the patch "IB/core: Release allocated memory in cache setup failure"
Available in the "topic/clean-alloc-prints" topic branch of this git repo:git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/clean-alloc-prints
Changes v0 -> v1:
* Patch 17: Return brackets removed by mistake.
Leon Romanovsky (17):
IB/mad: Remove debug prints after allocation failure IB/core: Remove debug prints after allocation failure IB/core: Release allocated memory in cache setup failure IB/mlx4: Remove debug prints after allocation failure IB/mlx5: Remove debug prints after allocation failure IB/hfi1: Remove debug prints after allocation failure IB/cxgb3: Remove debug prints after allocation failure IB/cxgb4: Remove debug prints after allocation failure IB/i40iw: Remove debug prints after allocation failure IB/qib: Remove debug prints after allocation failure IB/nes: Remove debug prints after allocation failure IB/mthca: Remove debug prints after allocation failure IB/usninc: Remove and fix debug prints after allocation failure IB/ocrdma: Remove and fix debug prints after allocation failure IB/rxe: Remove and fix debug prints after allocation failure IB/isert: Remove and fix debug prints after allocation failure IB/ipoib: Remove and fix debug prints after allocation failure
drivers/infiniband/core/agent.c | 1 - drivers/infiniband/core/cache.c | 16 ++++----- drivers/infiniband/core/device.c | 5 +-- drivers/infiniband/core/fmr_pool.c | 1 - drivers/infiniband/core/iwpm_msg.c | 1 - drivers/infiniband/core/iwpm_util.c | 12 +++---- drivers/infiniband/core/mad.c | 40 ++++------------------- drivers/infiniband/core/roce_gid_mgmt.c | 21 ++++-------- drivers/infiniband/hw/cxgb3/cxio_dbg.c | 20 +++++------- drivers/infiniband/hw/cxgb4/device.c | 4 --- drivers/infiniband/hw/hfi1/pio.c | 1 - drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 -- drivers/infiniband/hw/i40iw/i40iw_main.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 - drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +-- drivers/infiniband/hw/mlx4/cm.c | 4 +-- drivers/infiniband/hw/mlx4/mad.c | 9 ++--- drivers/infiniband/hw/mlx4/main.c | 16 ++------- drivers/infiniband/hw/mlx4/mcg.c | 5 +-- drivers/infiniband/hw/mlx5/srq.c | 2 -- drivers/infiniband/hw/mthca/mthca_reset.c | 4 --- drivers/infiniband/hw/nes/nes.c | 1 - drivers/infiniband/hw/nes/nes_cm.c | 4 +-- drivers/infiniband/hw/nes/nes_hw.c | 6 ++-- drivers/infiniband/hw/nes/nes_mgt.c | 10 ++---- drivers/infiniband/hw/nes/nes_verbs.c | 4 --- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 5 ++- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 +-- drivers/infiniband/hw/qib/qib_diag.c | 6 +--- drivers/infiniband/hw/qib/qib_eeprom.c | 6 +--- drivers/infiniband/hw/qib/qib_iba6120.c | 8 +---- drivers/infiniband/hw/qib/qib_iba7220.c | 8 +---- drivers/infiniband/hw/qib/qib_iba7322.c | 22 +++---------- drivers/infiniband/hw/qib/qib_init.c | 47 +++++---------------------- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 10 +----- drivers/infiniband/hw/usnic/usnic_vnic.c | 22 ++++--------- drivers/infiniband/sw/rxe/rxe_pool.c | 1 - drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 +---- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 5 +-- drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 +-- drivers/infiniband/ulp/isert/ib_isert.c | 23 ++++--------- 41 files changed, 84 insertions(+), 295 deletions(-)
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1478184265-9620-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH 1/17 IB/mad: Remove debug prints after allocation failure
The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/core/mad.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-)
drivers/infiniband/core/mad.c +6 -34
@@ -816,7 +816,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, local =kmalloc (sizeof *local,GFP_ATOMIC );if (!local) { ret = -ENOMEM ; -dev_err (&device->dev,"No memory for ib_mad_local_private\n" ); goto out; } local->mad_priv =NULL ;
@@ -824,7 +823,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, mad_priv =alloc_mad_private (mad_size,GFP_ATOMIC );if (!mad_priv) { ret = -ENOMEM ; -dev_err (&device->dev,"No memory for local response MAD\n" );kfree (local); goto out; }
@@ -947,9 +945,6 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr,for (left = send_buf->data_len + pad; left >0 ; left -= seg_size) { seg =kmalloc (sizeof (*seg) + seg_size, gfp_mask);if (!seg) { -dev_err (&send_buf->mad_agent->device->dev, -"alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n" , -sizeof (*seg) + seg_size, gfp_mask);free_send_rmpp_list (send_wr);return -ENOMEM ; }
@@ -1362,12 +1357,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method) {/* Allocate management method table */ *method =kzalloc (sizeof **method,GFP_ATOMIC ); -if (!*method) { -pr_err ("No memory for ib_mad_mgmt_method_table\n" ); -return -ENOMEM ; - } - -return 0 ; +return (*method) ?0 : (-ENOMEM ); }/*
@@ -1458,8 +1448,6 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,/* Allocate management class table for "new" class version */ *class =kzalloc (sizeof **class,GFP_ATOMIC );if (!*class) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_class_table\n" ); ret = -ENOMEM ; goto error1; }
@@ -1524,22 +1512,16 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,if (!*vendor_table) {/* Allocate mgmt vendor class table for "new" class version */ vendor =kzalloc (sizeof *vendor,GFP_ATOMIC ); -if (!vendor) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_vendor_class_table\n" ); +if (!vendor) goto error1; - } *vendor_table = vendor; }if (!(*vendor_table)->vendor_class[vclass]) {/* Allocate table for this management vendor class */ vendor_class =kzalloc (sizeof *vendor_class,GFP_ATOMIC ); -if (!vendor_class) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_vendor_class\n" ); +if (!vendor_class) goto error2; - } (*vendor_table)->vendor_class[vclass] = vendor_class; }
@@ -2238,11 +2220,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_size = recv->mad_size; response =alloc_mad_private (mad_size,GFP_KERNEL ); -if (!response) { -dev_err (&port_priv->device->dev, -"%s: no memory for response buffer\n" , __func__); +if (!response) goto out; - }if (rdma_cap_ib_switch (port_priv->device)) port_num = wc->port_num;
@@ -2869,8 +2848,6 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, mad_priv =alloc_mad_private (port_mad_size (qp_info->port_priv),GFP_ATOMIC );if (!mad_priv) { -dev_err (&qp_info->port_priv->device->dev, -"No memory for receive buffer\n" ); ret = -ENOMEM ;break ; }
@@ -2961,11 +2938,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)u16 pkey_index; attr =kmalloc (sizeof *attr,GFP_KERNEL ); -if (!attr) { -dev_err (&port_priv->device->dev, -"Couldn't kmalloc ib_qp_attr\n" ); +if (!attr)return -ENOMEM ; - } ret =ib_find_pkey (port_priv->device, port_priv->port_num,IB_DEFAULT_PKEY_FULL , &pkey_index);
@@ -3135,10 +3109,8 @@ static int ib_mad_port_open(struct ib_device *device,/* Create new device info */ port_priv =kzalloc (sizeof *port_priv,GFP_KERNEL ); -if (!port_priv) { -dev_err (&device->dev,"No memory for ib_mad_port_private\n" ); +if (!port_priv)return -ENOMEM ; - } port_priv->device = device; port_priv->port_num = port_num;
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1478184265-9620-2-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
ira.weiny
Reviewed-byRe: [PATCH rdma-next V1 01/17] IB/mad: Remove debug prints after allocation failure
Quoted 5 lines · Leon Romanovsky
The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
Signed-off-by Leon Romanovsky <[email protected]>
Quoted 136 lines
--- drivers/infiniband/core/mad.c | 40 ++++++---------------------------------- 1 file changed, 6 insertions(+), 34 deletions(-)drivers/infiniband/core/mad.c +6
-34@@ -816,7 +816,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, local =kmalloc (sizeof *local,GFP_ATOMIC );if (!local) { ret = -ENOMEM ; -dev_err (&device->dev,"No memory for ib_mad_local_private\n" ); goto out; } local->mad_priv =NULL ;@@ -824,7 +823,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, mad_priv =alloc_mad_private (mad_size,GFP_ATOMIC );if (!mad_priv) { ret = -ENOMEM ; -dev_err (&device->dev,"No memory for local response MAD\n" );kfree (local); goto out; }@@ -947,9 +945,6 @@ static int alloc_send_rmpp_list(struct ib_mad_send_wr_private *send_wr,for (left = send_buf->data_len + pad; left >0 ; left -= seg_size) { seg =kmalloc (sizeof (*seg) + seg_size, gfp_mask);if (!seg) { -dev_err (&send_buf->mad_agent->device->dev, -"alloc_send_rmpp_segs: RMPP mem alloc failed for len %zd, gfp %#x\n" , -sizeof (*seg) + seg_size, gfp_mask);free_send_rmpp_list (send_wr);return -ENOMEM ; }@@ -1362,12 +1357,7 @@ static int allocate_method_table(struct ib_mad_mgmt_method_table **method) {/* Allocate management method table */ *method =kzalloc (sizeof **method,GFP_ATOMIC ); -if (!*method) { -pr_err ("No memory for ib_mad_mgmt_method_table\n" ); -return -ENOMEM ; - } - -return 0 ; +return (*method) ?0 : (-ENOMEM ); }/* @@ -1458,8 +1448,6 @@ static int add_nonoui_reg_req(struct ib_mad_reg_req *mad_reg_req,/* Allocate management class table for "new" class version */ *class =kzalloc (sizeof **class,GFP_ATOMIC );if (!*class) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_class_table\n" ); ret = -ENOMEM ; goto error1; }@@ -1524,22 +1512,16 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req,if (!*vendor_table) {/* Allocate mgmt vendor class table for "new" class version */ vendor =kzalloc (sizeof *vendor,GFP_ATOMIC ); -if (!vendor) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_vendor_class_table\n" ); +if (!vendor) goto error1; - } *vendor_table = vendor; }if (!(*vendor_table)->vendor_class[vclass]) {/* Allocate table for this management vendor class */ vendor_class =kzalloc (sizeof *vendor_class,GFP_ATOMIC ); -if (!vendor_class) { -dev_err (&agent_priv->agent.device->dev, -"No memory for ib_mad_mgmt_vendor_class\n" ); +if (!vendor_class) goto error2; - } (*vendor_table)->vendor_class[vclass] = vendor_class; }@@ -2238,11 +2220,8 @@ static void ib_mad_recv_done(struct ib_cq *cq, struct ib_wc *wc) mad_size = recv->mad_size; response =alloc_mad_private (mad_size,GFP_KERNEL ); -if (!response) { -dev_err (&port_priv->device->dev, -"%s: no memory for response buffer\n" , __func__); +if (!response) goto out; - }if (rdma_cap_ib_switch (port_priv->device)) port_num = wc->port_num;@@ -2869,8 +2848,6 @@ static int ib_mad_post_receive_mads(struct ib_mad_qp_info *qp_info, mad_priv =alloc_mad_private (port_mad_size (qp_info->port_priv),GFP_ATOMIC );if (!mad_priv) { -dev_err (&qp_info->port_priv->device->dev, -"No memory for receive buffer\n" ); ret = -ENOMEM ;break ; }@@ -2961,11 +2938,8 @@ static int ib_mad_port_start(struct ib_mad_port_private *port_priv)u16 pkey_index; attr =kmalloc (sizeof *attr,GFP_KERNEL ); -if (!attr) { -dev_err (&port_priv->device->dev, -"Couldn't kmalloc ib_qp_attr\n" ); +if (!attr)return -ENOMEM ; - } ret =ib_find_pkey (port_priv->device, port_priv->port_num,IB_DEFAULT_PKEY_FULL , &pkey_index);@@ -3135,10 +3109,8 @@ static int ib_mad_port_open(struct ib_device *device,/* Create new device info */ port_priv =kzalloc (sizeof *port_priv,GFP_KERNEL ); -if (!port_priv) { -dev_err (&device->dev,"No memory for ib_mad_port_private\n" ); +if (!port_priv)return -ENOMEM ; - } port_priv->device = device; port_priv->port_num = port_num;Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/17 IB/core: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/core/agent.c | 1 - drivers/infiniband/core/device.c | 5 +---- drivers/infiniband/core/fmr_pool.c | 1 - drivers/infiniband/core/iwpm_msg.c | 1 - drivers/infiniband/core/iwpm_util.c | 12 ++++-------- drivers/infiniband/core/roce_gid_mgmt.c | 21 ++++++--------------- 6 files changed, 11 insertions(+), 30 deletions(-)
drivers/infiniband/core/agent.c +0 -1
@@ -156,7 +156,6 @@ int ib_agent_port_open(struct ib_device *device, int port_num)/* Create new device info */ port_priv =kzalloc (sizeof *port_priv,GFP_KERNEL );if (!port_priv) { -dev_err (&device->dev,"No memory for ib_agent_port_private\n" ); ret = -ENOMEM ; goto error1; }
drivers/infiniband/core/device.c +1 -4
@@ -254,11 +254,8 @@ static int add_client_context(struct ib_device *device, struct ib_client *clientunsigned long flags; context =kmalloc (sizeof *context,GFP_KERNEL ); -if (!context) { -pr_warn ("Couldn't allocate client context for %s/%s\n" , - device->name, client->name); +if (!context)return -ENOMEM ; - } context->client = client; context->data =NULL ;
drivers/infiniband/core/fmr_pool.c +0 -1
@@ -247,7 +247,6 @@ struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,kmalloc (IB_FMR_HASH_SIZE *sizeof *pool->cache_bucket,GFP_KERNEL );if (!pool->cache_bucket) { -pr_warn (PFX "Failed to allocate cache in pool\n" ); ret = -ENOMEM ; goto out_free_pool; }
drivers/infiniband/core/iwpm_msg.c +0 -1
@@ -604,7 +604,6 @@ int iwpm_remote_info_cb(struct sk_buff *skb, struct netlink_callback *cb) } rem_info =kzalloc (sizeof (struct iwpm_remote_info ),GFP_ATOMIC );if (!rem_info) { -pr_err ("%s: Unable to allocate a remote info\n" , __func__); ret = -ENOMEM ;return ret; }
drivers/infiniband/core/iwpm_util.c +4 -8
@@ -62,7 +62,6 @@ int iwpm_init(u8 nl_client) sizeof(struct hlist_head), GFP_KERNEL);if (!iwpm_hash_bucket) { ret = -ENOMEM ; -pr_err ("%s Unable to create mapinfo hash table\n" , __func__); goto init_exit; } iwpm_reminfo_bucket = kzalloc(IWPM_REMINFO_HASH_SIZE *
@@ -70,7 +69,6 @@ int iwpm_init(u8 nl_client)if (!iwpm_reminfo_bucket) {kfree (iwpm_hash_bucket); ret = -ENOMEM ; -pr_err ("%s Unable to create reminfo hash table\n" , __func__); goto init_exit; } }
@@ -128,10 +126,9 @@ int iwpm_create_mapinfo(struct sockaddr_storage *local_sockaddr,if (!iwpm_valid_client (nl_client))return ret; map_info =kzalloc (sizeof (struct iwpm_mapping_info ),GFP_KERNEL ); -if (!map_info) { -pr_err ("%s: Unable to allocate a mapping info\n" , __func__); +if (!map_info)return -ENOMEM ; - } +memcpy (&map_info->local_sockaddr, local_sockaddr,sizeof (struct sockaddr_storage )); memcpy(&map_info->mapped_sockaddr, mapped_sockaddr,
@@ -309,10 +306,9 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq,unsigned long flags; nlmsg_request =kzalloc (sizeof (struct iwpm_nlmsg_request ), gfp); -if (!nlmsg_request) { -pr_err ("%s Unable to allocate a nlmsg_request\n" , __func__); +if (!nlmsg_request)return NULL ; - } +spin_lock_irqsave (&iwpm_nlmsg_req_lock, flags);list_add_tail (&nlmsg_request->inprocess_list, &iwpm_nlmsg_req_list);spin_unlock_irqrestore (&iwpm_nlmsg_req_lock, flags);
drivers/infiniband/core/roce_gid_mgmt.c +6 -15
@@ -304,10 +304,9 @@ static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,for_ifa (in_dev) {struct sin_list *entry =kzalloc (sizeof (*entry),GFP_ATOMIC ); -if (!entry) { -pr_warn ("roce_gid_mgmt: couldn't allocate entry for IPv4 update\n" ); +if (!entry)continue ; - } + entry->ip.sin_family =AF_INET ; entry->ip.sin_addr.s_addr = ifa->ifa_address;list_add_tail (&entry->list, &sin_list);
@@ -348,10 +347,8 @@ static void enum_netdev_ipv6_ips(struct ib_device *ib_dev,list_for_each_entry (ifp, &in6_dev->addr_list, if_list) {struct sin6_list *entry =kzalloc (sizeof (*entry),GFP_ATOMIC ); -if (!entry) { -pr_warn ("roce_gid_mgmt: couldn't allocate entry for IPv6 update\n" ); +if (!entry)continue ; - } entry->sin6.sin6_family =AF_INET6 ; entry->sin6.sin6_addr = ifp->addr;
@@ -459,10 +456,8 @@ static void handle_netdev_upper(struct ib_device *ib_dev, u8 port,struct upper_list *entry =kmalloc (sizeof (*entry),GFP_ATOMIC ); -if (!entry) { -pr_info ("roce_gid_mgmt: couldn't allocate entry to delete ndev\n" ); +if (!entry)continue ; - }list_add_tail (&entry->list, &upper_list);dev_hold (upper);
@@ -555,10 +550,8 @@ static int netdevice_queue_work(struct netdev_event_work_cmd *cmds,struct netdev_event_work *ndev_work =kmalloc (sizeof (*ndev_work),GFP_KERNEL ); -if (!ndev_work) { -pr_warn ("roce_gid_mgmt: can't allocate work for netdevice_event\n" ); +if (!ndev_work)return NOTIFY_DONE ; - }memcpy (ndev_work->cmds, cmds,sizeof (ndev_work->cmds));for (i =0 ; i <ARRAY_SIZE (ndev_work->cmds) && ndev_work->cmds[i].cb; i++) {
@@ -692,10 +685,8 @@ static int addr_event(struct notifier_block *this, unsigned long event, } work =kmalloc (sizeof (*work),GFP_ATOMIC ); -if (!work) { -pr_warn ("roce_gid_mgmt: Couldn't allocate work for addr_event\n" ); +if (!work)return NOTIFY_DONE ; - }INIT_WORK (&work->work, update_gid_event_work_handler);
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/17 IB/core: Release allocated memory in cache setup failure
In reply to a message not in the archiveThe failure in ib_cache_setup_one function during ib_register_device will leave leaked allocated memory.
--- drivers/infiniband/core/cache.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/infiniband/core/cache.c +7 -9
@@ -770,12 +770,8 @@ static int _gid_table_setup_one(struct ib_device *ib_dev)int err =0 ; table =kcalloc (ib_dev->phys_port_cnt,sizeof (*table),GFP_KERNEL ); - -if (!table) { -pr_warn ("failed to allocate ib gid cache for %s\n" , - ib_dev->name); +if (!table)return -ENOMEM ; - }for (port =0 ; port < ib_dev->phys_port_cnt; port++) {u8 rdma_port = port +rdma_start_port (ib_dev);
@@ -1170,14 +1166,13 @@ int ib_cache_setup_one(struct ib_device *device) GFP_KERNEL);if (!device->cache.pkey_cache || !device->cache.lmc_cache) { -pr_warn ("Couldn't allocate cache for %s\n" , device->name); -return -ENOMEM ; + err = -ENOMEM ; + goto free; } err =gid_table_setup_one (device);if (err) -/* Allocated memory will be cleaned in the release function */ -return err; + goto free;for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p)ib_cache_update (device, p +rdma_start_port (device));
@@ -1192,6 +1187,9 @@ int ib_cache_setup_one(struct ib_device *device) err:gid_table_cleanup_one (device); +free: +kfree (device->cache.pkey_cache); +kfree (device->cache.lmc_cache);return err; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1478184265-9620-4-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Re: [PATCH rdma-next V1 03/17] IB/core: Release allocated memory in cache setup failure
Quoted 15 lines · Leon Romanovsky
The failure in
ib_cache_setup_onefunction duringib_register_devicewill leave leaked allocated memory.Fixes 03db3a2d81e6 ("IB/core: Add RoCE GID table management")Signed-off-by Leon Romanovsky <[email protected]>--- drivers/infiniband/core/cache.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)drivers/infiniband/core/cache.c +0
-0
drivers/infiniband/core/cache.c static int _gid_table_setup_one(struct ib_device *ib_dev) · line 778
Quoted 10 lines
drivers/infiniband/core/cache.c +1
-5@@ -770,12 +770,8 @@ static int _gid_table_setup_one(struct ib_device *ib_dev)int err =0 ; table =kcalloc (ib_dev->phys_port_cnt,sizeof (*table),GFP_KERNEL ); - -if (!table) { -pr_warn ("failed to allocate ib gid cache for %s\n" , - ib_dev->name); +if (!table)return -ENOMEM ; - }
NIT: I think this would be worth separating out.
Quoted 22 lines
drivers/infiniband/core/cache.c +3
-4for (port =0 ; port < ib_dev->phys_port_cnt; port++) {u8 rdma_port = port +rdma_start_port (ib_dev);@@ -1170,14 +1166,13 @@ int ib_cache_setup_one(struct ib_device *device) GFP_KERNEL);if (!device->cache.pkey_cache || !device->cache.lmc_cache) { -pr_warn ("Couldn't allocate cache for %s\n" , device->name); -return -ENOMEM ; + err = -ENOMEM ; + goto free; } err =gid_table_setup_one (device);if (err) -/* Allocated memory will be cleaned in the release function */ -return err; + goto free;for (p =0 ; p <=rdma_end_port (device) -rdma_start_port (device); ++p)ib_cache_update (device, p +rdma_start_port (device));
drivers/infiniband/core/cache.c int ib_cache_setup_one(struct ib_device *device) · line 1192
Quoted 6 lines
drivers/infiniband/core/cache.c +3
-0@@ -1192,6 +1187,9 @@ int ib_cache_setup_one(struct ib_device *device) err:gid_table_cleanup_one (device); +free: +kfree (device->cache.pkey_cache); +kfree (device->cache.lmc_cache);
Despite the fact that another thread said this is supposed to be ok because ib_cache_release_one free's these I much prefer what you have done here.
However, don't you need to NULL these out so that ib_cache_release_one can safely call kfree again?
Ira
Quoted 10 lines
drivers/infiniband/core/cache.c +0
-0return err; }Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20161216034218.GA12582-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org
Re: [PATCH rdma-next V1 03/17] IB/core: Release allocated memory in cache setup failure
Quoted 11 lines · ira.weiny
drivers/infiniband/core/cache.c int ib_cache_setup_one(struct ib_device *device) · line 1192
Quoted 5 lines
err:
drivers/infiniband/core/cache.c +3
-0gid_table_cleanup_one (device); +free: +kfree (device->cache.pkey_cache); +kfree (device->cache.lmc_cache);Despite the fact that another thread said this is supposed to be ok because
ib_cache_release_onefree's these I much prefer what you have done here.However, don't you need to NULL these out so that
ib_cache_release_onecan safely call kfree again?
Yes.
I feel deja vue here, like I've pointed this out before and the resolution was to just rely on the release function so we don't have bugs like this.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20161216042743.GD3797-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org
Re: [PATCH rdma-next V1 03/17] IB/core: Release allocated memory in cache setup failure
Quoted 10 lines · Jason Gunthorpe
Quoted 9 lines · ira.weiny
drivers/infiniband/core/cache.c int ib_cache_setup_one(struct ib_device *device) · line 1192
Quoted 5 lines
err:
drivers/infiniband/core/cache.c +3
-0gid_table_cleanup_one (device); +free: +kfree (device->cache.pkey_cache); +kfree (device->cache.lmc_cache);Despite the fact that another thread said this is supposed to be ok because
ib_cache_release_onefree's these I much prefer what you have done here.
Quoted 8 lines
Quoted 2 lines
However, don't you need to NULL these out so that
ib_cache_release_onecan safely call kfree again?Yes.
I feel deja vue here, like I've pointed this out before and the resolution was to just rely on the release function so we don't have bugs like this.
I'm sure that I missed it, can you point me to that discussion? Thanks
Quoted 2 lines
Jason
PATCH 4/17 IB/mlx4: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +--- drivers/infiniband/hw/mlx4/cm.c | 4 +--- drivers/infiniband/hw/mlx4/mad.c | 9 ++------- drivers/infiniband/hw/mlx4/main.c | 16 +++------------- drivers/infiniband/hw/mlx4/mcg.c | 5 +---- 5 files changed, 8 insertions(+), 30 deletions(-)
drivers/infiniband/hw/mlx4/alias_GUID.c +1 -3
@@ -755,10 +755,8 @@ static void alias_guid_work(struct work_struct *work) struct mlx4_ib_dev *dev = container_of(ib_sriov, struct mlx4_ib_dev, sriov); rec =kzalloc (sizeof *rec,GFP_KERNEL ); -if (!rec) { -pr_err ("alias_guid_work: No Memory\n" ); +if (!rec)return ; - }pr_debug ("starting [port: %d]...\n" , sriov_alias_port->port +1 ); ret =get_next_record_to_update (dev, sriov_alias_port->port, rec);
drivers/infiniband/hw/mlx4/cm.c +1 -3
@@ -247,10 +247,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)struct mlx4_ib_sriov *sriov = &to_mdev (ibdev)->sriov; ent =kmalloc (sizeof (struct id_map_entry ),GFP_KERNEL ); -if (!ent) { -mlx4_ib_warn (ibdev,"Couldn't allocate id cache entry - out of memory\n" ); +if (!ent)return ERR_PTR (-ENOMEM ); - } ent->sl_cm_id = sl_cm_id; ent->slave_id = slave_id;
drivers/infiniband/hw/mlx4/mad.c +2 -7
@@ -1102,10 +1102,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num, in_mad =kmalloc (sizeof *in_mad,GFP_KERNEL ); out_mad =kmalloc (sizeof *out_mad,GFP_KERNEL ); -if (!in_mad || !out_mad) { -mlx4_ib_warn (&dev->ib_dev,"failed to allocate memory for guid info mads\n" ); +if (!in_mad || !out_mad) goto out; - } guid_tbl_blk_num *=4 ;
@@ -1916,11 +1914,8 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port, *ret_ctx =NULL ; ctx =kzalloc (sizeof (struct mlx4_ib_demux_pv_ctx ),GFP_KERNEL ); -if (!ctx) { -pr_err ("failed allocating pv resource context " -"for port %d, slave %d\n" , port, slave); +if (!ctx)return -ENOMEM ; - } ctx->ib_dev = &dev->ib_dev; ctx->port = port;
drivers/infiniband/hw/mlx4/main.c +3 -13
@@ -2814,11 +2814,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)kmalloc (BITS_TO_LONGS (ibdev->steer_qpn_count) *sizeof (long ),GFP_KERNEL ); -if (!ibdev->ib_uc_qpns_bitmap) { -dev_err (&dev->persist->pdev->dev, -"bit map alloc failed\n" ); +if (!ibdev->ib_uc_qpns_bitmap) goto err_steer_qp_release; - }bitmap_zero (ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count);
@@ -3055,15 +3052,12 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init) first_port =find_first_bit (actv_ports.ports, dev->caps.num_ports); dm =kcalloc (ports,sizeof (*dm),GFP_ATOMIC ); -if (!dm) { -pr_err ("failed to allocate memory for tunneling qp update\n" ); +if (!dm)return ; - }for (i =0 ; i < ports; i++) { dm[i] =kmalloc (sizeof (struct mlx4_ib_demux_work ),GFP_ATOMIC );if (!dm[i]) { -pr_err ("failed to allocate memory for tunneling qp update work struct\n" );while (--i >=0 )kfree (dm[i]); goto out;
@@ -3223,8 +3217,6 @@ void mlx4_sched_ib_sl2vl_update_work(struct mlx4_ib_dev *ibdev, ew->port = port; ew->ib_dev = ibdev;queue_work (wq, &ew->work); - }else { -pr_err ("failed to allocate memory for sl2vl update work\n" ); } }
@@ -3284,10 +3276,8 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,case MLX4_DEV_EVENT_PORT_MGMT_CHANGE : ew =kmalloc (sizeof *ew,GFP_ATOMIC ); -if (!ew) { -pr_err ("failed to allocate memory for events work\n" ); +if (!ew)break ; - }INIT_WORK (&ew->work, handle_port_mgmt_change_event);memcpy (&ew->ib_eqe, eqe,sizeof *eqe);
drivers/infiniband/hw/mlx4/mcg.c +1 -4
@@ -1142,7 +1142,6 @@ void mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy_wq) work =kmalloc (sizeof *work,GFP_KERNEL );if (!work) { ctx->flushing =0 ; -mcg_warn ("failed allocating work for cleanup\n" );return ; }
@@ -1202,10 +1201,8 @@ static int push_deleteing_req(struct mcast_group *group, int slave)return 0 ; req =kzalloc (sizeof *req,GFP_KERNEL ); -if (!req) { -mcg_warn_group (group,"failed allocation - may leave stall groups\n" ); +if (!req)return -ENOMEM ; - }if (!list_empty (&group->func[slave].pending)) { pend_req = list_entry(group->func[slave].pending.prev, struct mcast_req, group_list);
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 5/17 IB/mlx5: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/mlx5/srq.c | 2 -- 1 file changed, 2 deletions(-)
drivers/infiniband/hw/mlx5/srq.c +0 -2
@@ -203,8 +203,6 @@ static int create_srq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_srq *srq, srq->wrid =kmalloc (srq->msrq.max *sizeof (u64),GFP_KERNEL );if (!srq->wrid) { -mlx5_ib_dbg (dev,"kmalloc failed %lu\n" , - (unsigned long )(srq->msrq.max *sizeof (u64))); err = -ENOMEM ; goto err_in; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/17 IB/hfi1: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/hfi1/pio.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/hw/hfi1/pio.c +0 -1
@@ -2053,7 +2053,6 @@ int init_credit_return(struct hfi1_devdata *dd)sizeof (struct credit_return_base ), GFP_KERNEL);if (!dd->cr_base) { -dd_dev_err (dd,"Unable to allocate credit return base\n" ); ret = -ENOMEM ; goto done; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1478184265-9620-7-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Re: [PATCH rdma-next V1 06/17] IB/hfi1: Remove debug prints after allocation failure
T24gVGh1LCAyMDE2LTExLTAzIGF0IDE2OjQ0ICswMjAwLCBMZW9uIFJvbWFub3Zza3kgd3JvdGU6 DQo+IFRoZSBwcmludHMgYWZ0ZXIgW2t8dl1bbXx6fGNdYWxsb2MoKSBmdW5jdGlvbnMgYXJlIG5v dCBuZWVkZWQsDQo+IGJlY2F1c2UgaW4gY2FzZSBvZiBmYWlsdXJlLCBhbGxvY2F0b3Igd2lsbCBw cmludCB0aGVpciBpbnRlcm5hbA0KPiBlcnJvciBwcmludHMgYW55d2F5Lg0KPiANCj4gU2lnbmVk LW9mZi1ieTogTGVvbiBSb21hbm92c2t5IDxsZW9uQGtlcm5lbC5vcmc+DQoNCkFja2VkLWJ5OiBE ZW5uaXMgRGFsZXNzYW5kcm8gPGRlbm5pcy5kYWxlc3NhbmRyb0BpbnRlbC5jb20+ --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH rdma-next V1 06/17] IB/hfi1: Remove debug prints after allocation failure
Quoted 9 lines · Dennis
Quoted 6 lines · Leon Romanovsky
The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
Signed-off-by Leon Romanovsky <[email protected]>
Hi Denny,
Your Ack was not recorded by patchworks. Something about the way it was signed or something like that. All patchworks saw was what looked like an encyrpted or signed block, with no legible text.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
PATCH 7/17 IB/cxgb3: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/cxgb3/cxio_dbg.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/infiniband/hw/cxgb3/cxio_dbg.c +8 -12
@@ -45,10 +45,9 @@ void cxio_dump_tpt(struct cxio_rdev *rdev, u32 stag)int size =32 ; m =kmalloc (sizeof (*m) + size,GFP_ATOMIC ); -if (!m) { -PDBG ("%s couldn't allocate memory.\n" , __func__); +if (!m)return ; - } + m->mem_id =MEM_PMRX ; m->addr = (stag>>8 ) *32 + rdev->rnic_info.tpt_base; m->len = size;
@@ -82,10 +81,9 @@ void cxio_dump_pbl(struct cxio_rdev *rdev, u32 pbl_addr, uint len, u8 shift) size = npages *sizeof (u64); m =kmalloc (sizeof (*m) + size,GFP_ATOMIC ); -if (!m) { -PDBG ("%s couldn't allocate memory.\n" , __func__); +if (!m)return ; - } + m->mem_id =MEM_PMRX ; m->addr = pbl_addr; m->len = size;
@@ -144,10 +142,9 @@ void cxio_dump_rqt(struct cxio_rdev *rdev, u32 hwtid, int nents)int rc; m =kmalloc (sizeof (*m) + size,GFP_ATOMIC ); -if (!m) { -PDBG ("%s couldn't allocate memory.\n" , __func__); +if (!m)return ; - } + m->mem_id =MEM_PMRX ; m->addr = ((hwtid)<<10 ) + rdev->rnic_info.rqt_base; m->len = size;
@@ -177,10 +174,9 @@ void cxio_dump_tcb(struct cxio_rdev *rdev, u32 hwtid)int rc; m =kmalloc (sizeof (*m) + size,GFP_ATOMIC ); -if (!m) { -PDBG ("%s couldn't allocate memory.\n" , __func__); +if (!m)return ; - } + m->mem_id =MEM_CM ; m->addr = hwtid * size; m->len = size;
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 8/17 IB/cxgb4: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/cxgb4/device.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/infiniband/hw/cxgb4/device.c +0 -4
@@ -841,8 +841,6 @@ static int c4iw_rdev_open(struct c4iw_rdev *rdev)if (rdev->wr_log) { rdev->wr_log_size =1 << c4iw_wr_log_size_order;atomic_set (&rdev->wr_log_idx,0 ); - }else { -pr_err (MOD "error allocating wr_log. Logging disabled\n" ); } }
@@ -1424,8 +1422,6 @@ static void recover_queues(struct uld_ctx *ctx) qp_list.qps =kzalloc (count *sizeof *qp_list.qps,GFP_ATOMIC );if (!qp_list.qps) { - printk(KERN_ERR MOD "%s: Fatal error - DB overflow recovery failed\n", - pci_name(ctx->lldi.pdev));spin_unlock_irq (&ctx->dev->lock);return ; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 9/17 IB/i40iw: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 -- drivers/infiniband/hw/i40iw/i40iw_main.c | 5 ++--- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 - 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_cm.c +0 -2
@@ -1675,7 +1675,6 @@ static enum i40iw_status_code i40iw_add_mqh_6(struct i40iw_device *iwdev,"Allocating child listener %p\n" , child_listen_node);if (!child_listen_node) { -i40iw_pr_err ("listener memory allocation\n" ); ret =I40IW_ERR_NO_MEMORY ; goto exit; }
@@ -1751,7 +1750,6 @@ static enum i40iw_status_code i40iw_add_mqh_4("Allocating child listener %p\n" , child_listen_node);if (!child_listen_node) { -i40iw_pr_err ("listener memory allocation\n" );in_dev_put (idev); ret =I40IW_ERR_NO_MEMORY ; goto exit;
drivers/infiniband/hw/i40iw/i40iw_main.c +2 -3
@@ -1301,10 +1301,9 @@ static enum i40iw_status_code i40iw_initialize_dev(struct i40iw_device *iwdev, size =sizeof (struct i40iw_hmc_pble_rsrc ) +sizeof (struct i40iw_hmc_info ) + (sizeof (struct i40iw_hmc_obj_info ) *I40IW_HMC_IW_MAX ); iwdev->hmc_info_mem =kzalloc (size,GFP_KERNEL ); -if (!iwdev->hmc_info_mem) { -i40iw_pr_err ("memory alloc fail\n" ); +if (!iwdev->hmc_info_mem)return I40IW_ERR_NO_MEMORY ; - } + iwdev->pble_rsrc = (struct i40iw_hmc_pble_rsrc *)iwdev->hmc_info_mem; dev->hmc_info = &iwdev->hw.hmc; dev->hmc_info->hmc_obj = (struct i40iw_hmc_obj_info *)(iwdev->pble_rsrc +1 );
drivers/infiniband/hw/i40iw/i40iw_verbs.c +0 -1
@@ -2654,7 +2654,6 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev iwibdev->ibdev.iwcm =kzalloc (sizeof (*iwibdev->ibdev.iwcm),GFP_KERNEL );if (!iwibdev->ibdev.iwcm) {ib_dealloc_device (&iwibdev->ibdev); -i40iw_pr_err ("iwcm == NULL\n" );return NULL ; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 10/17 IB/qib: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/qib/qib_diag.c | 6 +---- drivers/infiniband/hw/qib/qib_eeprom.c | 6 +---- drivers/infiniband/hw/qib/qib_iba6120.c | 8 +----- drivers/infiniband/hw/qib/qib_iba7220.c | 8 +----- drivers/infiniband/hw/qib/qib_iba7322.c | 22 ++++----------- drivers/infiniband/hw/qib/qib_init.c | 47 ++++++--------------------------- 6 files changed, 17 insertions(+), 80 deletions(-)
drivers/infiniband/hw/qib/qib_diag.c +1 -5
@@ -609,8 +609,6 @@ static ssize_t qib_diagpkt_write(struct file *fp, tmpbuf =vmalloc (plen);if (!tmpbuf) { -qib_devinfo (dd->pcidev, -"Unable to allocate tmp buffer, failing\n" ); ret = -ENOMEM ; goto bail; }
@@ -702,10 +700,8 @@ int qib_register_observer(struct qib_devdata *dd,if (!dd || !op)return -EINVAL ; olp =vmalloc (sizeof (*olp)); -if (!olp) { -pr_err ("vmalloc for observer failed\n" ); +if (!olp)return -ENOMEM ; - }spin_lock_irqsave (&dd->qib_diag_trans_lock, flags); olp->op = op;
drivers/infiniband/hw/qib/qib_eeprom.c +1 -5
@@ -182,12 +182,8 @@ void qib_get_eeprom_info(struct qib_devdata *dd)* */ len =sizeof (struct qib_flash ); buf =vmalloc (len); -if (!buf) { -qib_dev_err (dd, -"Couldn't allocate memory to read %u bytes from eeprom for GUID\n" , - len); +if (!buf) goto bail; - }/* * Use "public" eeprom read function, which does locking and
drivers/infiniband/hw/qib/qib_iba6120.c +1 -7
@@ -1759,9 +1759,7 @@ static void pe_boardname(struct qib_devdata *dd) } namelen =strlen (n) +1 ; dd->boardname =kmalloc (namelen,GFP_KERNEL ); -if (!dd->boardname) -qib_dev_err (dd,"Failed allocation for board name: %s\n" , n); -else +if (dd->boardname)snprintf (dd->boardname, namelen,"%s" , n);if (dd->majrev !=4 || !dd->minrev || dd->minrev >2 )
@@ -2533,8 +2531,6 @@ static void init_6120_cntrnames(struct qib_devdata *dd) dd->cspec->cntrnamelen =1 + s - cntr6120names; dd->cspec->cntrs =kmalloc (dd->cspec->ncntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->cspec->cntrs) -qib_dev_err (dd,"Failed allocation for counters\n" );for (i =0 , s = (char *)portcntr6120names; s; i++) s =strchr (s +1 ,'\n' );
@@ -2542,8 +2538,6 @@ static void init_6120_cntrnames(struct qib_devdata *dd) dd->cspec->portcntrnamelen =sizeof (portcntr6120names) -1 ; dd->cspec->portcntrs =kmalloc (dd->cspec->nportcntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->cspec->portcntrs) -qib_dev_err (dd,"Failed allocation for portcounters\n" ); } static u32 qib_read_6120cntrs(struct qib_devdata *dd, loff_t pos, char **namep,
drivers/infiniband/hw/qib/qib_iba7220.c +1 -7
@@ -2070,9 +2070,7 @@ static void qib_7220_boardname(struct qib_devdata *dd) namelen =strlen (n) +1 ; dd->boardname =kmalloc (namelen,GFP_KERNEL ); -if (!dd->boardname) -qib_dev_err (dd,"Failed allocation for board name: %s\n" , n); -else +if (dd->boardname)snprintf (dd->boardname, namelen,"%s" , n);if (dd->majrev !=5 || !dd->minrev || dd->minrev >2 )
@@ -3179,8 +3177,6 @@ static void init_7220_cntrnames(struct qib_devdata *dd) dd->cspec->cntrnamelen =1 + s - cntr7220names; dd->cspec->cntrs =kmalloc (dd->cspec->ncntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->cspec->cntrs) -qib_dev_err (dd,"Failed allocation for counters\n" );for (i =0 , s = (char *)portcntr7220names; s; i++) s =strchr (s +1 ,'\n' );
@@ -3188,8 +3184,6 @@ static void init_7220_cntrnames(struct qib_devdata *dd) dd->cspec->portcntrnamelen =sizeof (portcntr7220names) -1 ; dd->cspec->portcntrs =kmalloc (dd->cspec->nportcntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->cspec->portcntrs) -qib_dev_err (dd,"Failed allocation for portcounters\n" ); } static u32 qib_read_7220cntrs(struct qib_devdata *dd, loff_t pos, char **namep,
drivers/infiniband/hw/qib/qib_iba7322.c +5 -17
@@ -3627,9 +3627,7 @@ static unsigned qib_7322_boardname(struct qib_devdata *dd) namelen =strlen (n) +1 ; dd->boardname =kmalloc (namelen,GFP_KERNEL ); -if (!dd->boardname) -qib_dev_err (dd,"Failed allocation for board name: %s\n" , n); -else +if (dd->boardname)snprintf (dd->boardname, namelen,"%s" , n); snprintf(dd->boardversion, sizeof(dd->boardversion),
@@ -3656,7 +3654,7 @@ static unsigned qib_7322_boardname(struct qib_devdata *dd)static int qib_do_7322_reset (struct qib_devdata *dd) {u64 val; -u64 *msix_vecsave; +u64 *msix_vecsave =NULL ;int i, msix_entries, ret =1 ;u16 cmdval;u8 int_line, clinesz;
@@ -3677,10 +3675,7 @@ static int qib_do_7322_reset(struct qib_devdata *dd)/* can be up to 512 bytes, too big for stack */ msix_vecsave =kmalloc (2 * dd->cspec->num_msix_entries *sizeof (u64),GFP_KERNEL ); -if (!msix_vecsave) -qib_dev_err (dd,"No mem to save MSIx data\n" ); - }else - msix_vecsave =NULL ; + }/* * Core PCI (as of 2.6.18) doesn't save or rewrite the full vector
@@ -5043,8 +5038,6 @@ static void init_7322_cntrnames(struct qib_devdata *dd) dd->cspec->cntrnamelen =1 + s - cntr7322names; dd->cspec->cntrs =kmalloc (dd->cspec->ncntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->cspec->cntrs) -qib_dev_err (dd,"Failed allocation for counters\n" );for (i =0 , s = (char *)portcntr7322names; s; i++) s =strchr (s +1 ,'\n' );
@@ -5053,9 +5046,6 @@ static void init_7322_cntrnames(struct qib_devdata *dd)for (i =0 ; i < dd->num_pports; ++i) { dd->pport[i].cpspec->portcntrs =kmalloc (dd->cspec->nportcntrs *sizeof (u64),GFP_KERNEL ); -if (!dd->pport[i].cpspec->portcntrs) -qib_dev_err (dd, -"Failed allocation for portcounters\n" ); } }
@@ -6461,7 +6451,6 @@ static int qib_init_7322_variables(struct qib_devdata *dd) sizeof(*dd->cspec->sendibchk), GFP_KERNEL);if (!dd->cspec->sendchkenable || !dd->cspec->sendgrhchk || !dd->cspec->sendibchk) { -qib_dev_err (dd,"Failed allocation for hdrchk bitmaps\n" ); ret = -ENOMEM ; goto bail; }
@@ -7338,10 +7327,9 @@ struct qib_devdata *qib_init_iba7322_funcs(struct pci_dev *pdev, tabsize = actual_cnt; dd->cspec->msix_entries =kzalloc (tabsize *sizeof (struct qib_msix_entry ),GFP_KERNEL ); -if (!dd->cspec->msix_entries) { -qib_dev_err (dd,"No memory for MSIx table\n" ); +if (!dd->cspec->msix_entries) tabsize =0 ; - } +for (i =0 ; i < tabsize; i++) dd->cspec->msix_entries[i].msix.entry = i;
drivers/infiniband/hw/qib/qib_init.c +8 -39
96 lines not on this page · raw message
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 11/17 IB/nes: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/nes/nes.c | 1 - drivers/infiniband/hw/nes/nes_cm.c | 4 +--- drivers/infiniband/hw/nes/nes_hw.c | 6 ++---- drivers/infiniband/hw/nes/nes_mgt.c | 10 +++------- drivers/infiniband/hw/nes/nes_verbs.c | 4 ---- 5 files changed, 6 insertions(+), 19 deletions(-)
drivers/infiniband/hw/nes/nes.c +0 -1
@@ -516,7 +516,6 @@ static int nes_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)/* Allocate hardware structure */ nesdev =kzalloc (sizeof (struct nes_device ),GFP_KERNEL );if (!nesdev) { - printk(KERN_ERR PFX "%s: Unable to alloc hardware struct\n", pci_name(pcidev)); ret = -ENOMEM ; goto bail2; }
drivers/infiniband/hw/nes/nes_cm.c +1 -3
@@ -2282,10 +2282,8 @@ static struct nes_cm_listener *mini_cm_listen(struct nes_cm_core *cm_core,if (!listener) {/* create a CM listen node (1/2 node to compare incoming traffic to) */ listener =kzalloc (sizeof (*listener),GFP_ATOMIC ); -if (!listener) { -nes_debug (NES_DBG_CM ,"Not creating listener memory allocation failed\n" ); +if (!listener)return NULL ; - } listener->loc_addr = cm_info->loc_addr; listener->loc_port = cm_info->loc_port;
drivers/infiniband/hw/nes/nes_hw.c +2 -4
@@ -351,9 +351,8 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {/* allocate a new adapter struct */ nesadapter =kzalloc (adapter_size,GFP_KERNEL ); -if (nesadapter ==NULL ) { +if (!nesadapter)return NULL ; - }nes_debug (NES_DBG_INIT ,"Allocating new nesadapter @ %p, size = %u (actual size = %u).\n" , nesadapter, (u32 )sizeof (struct nes_adapter ), adapter_size);
@@ -1007,8 +1006,7 @@ int nes_init_cqp(struct nes_device *nesdev)/* Allocate a twice the number of CQP requests as the SQ size */ nesdev->nes_cqp_requests =kzalloc (sizeof (struct nes_cqp_request ) *2 *NES_CQP_SQ_SIZE ,GFP_KERNEL ); -if (nesdev->nes_cqp_requests ==NULL ) { -nes_debug (NES_DBG_INIT ,"Unable to allocate memory CQP request entries.\n" ); +if (!nesdev->nes_cqp_requests) {pci_free_consistent (nesdev->pcidev, nesdev->cqp_mem_size, nesdev->cqp.sq_vbase, nesdev->cqp.sq_pbase);return -ENOMEM ;
drivers/infiniband/hw/nes/nes_mgt.c +3 -7
@@ -320,8 +320,7 @@ static int get_fpdu_info(struct nes_device *nesdev, struct nes_qp *nesqp,/* Found one */ fpdu_info =kzalloc (sizeof (*fpdu_info),GFP_ATOMIC ); -if (fpdu_info ==NULL ) { -nes_debug (NES_DBG_PAU ,"Failed to alloc a fpdu_info.\n" ); +if (!fpdu_info) { rc = -ENOMEM ; goto out; }
@@ -729,8 +728,7 @@ static int nes_change_quad_hash(struct nes_device *nesdev, } qh_chg =kmalloc (sizeof *qh_chg,GFP_ATOMIC ); -if (qh_chg ==NULL ) { -nes_debug (NES_DBG_PAU ,"Failed to get a cqp_request.\n" ); +if (!qh_chg) { ret = -ENOMEM ; goto chg_qh_err; }
@@ -880,10 +878,8 @@ int nes_init_mgt_qp(struct nes_device *nesdev, struct net_device *netdev, struct/* Allocate space the all mgt QPs once */ mgtvnic =kzalloc (NES_MGT_QP_COUNT *sizeof (struct nes_vnic_mgt ),GFP_KERNEL ); -if (mgtvnic ==NULL ) { -nes_debug (NES_DBG_INIT ,"Unable to allocate memory for mgt structure\n" ); +if (!mgtvnic)return -ENOMEM ; - }/* Allocate fragment, RQ, and CQ; Reuse CEQ based on the PCI function */ /* We are not sending from this NIC so sq is not allocated */
drivers/infiniband/hw/nes/nes_verbs.c +0 -4
@@ -1075,7 +1075,6 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd, mem =kzalloc (sizeof (*nesqp)+NES_SW_CONTEXT_ALIGN -1 ,GFP_KERNEL );if (!mem) {nes_free_resource (nesadapter, nesadapter->allocated_qps, qp_num); -nes_debug (NES_DBG_QP ,"Unable to allocate QP\n" );return ERR_PTR (-ENOMEM ); } u64nesqp = (unsigned long )mem;
@@ -1475,7 +1474,6 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, nescq =kzalloc (sizeof (struct nes_cq ),GFP_KERNEL );if (!nescq) {nes_free_resource (nesadapter, nesadapter->allocated_cqs, cq_num); -nes_debug (NES_DBG_CQ ,"Unable to allocate nes_cq struct\n" );return ERR_PTR (-ENOMEM ); }
@@ -2408,7 +2406,6 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, } nespbl =kzalloc (sizeof (*nespbl),GFP_KERNEL );if (!nespbl) { -nes_debug (NES_DBG_MR ,"Unable to allocate PBL\n" );ib_umem_release (region);return ERR_PTR (-ENOMEM ); }
@@ -2416,7 +2413,6 @@ static struct ib_mr *nes_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,if (!nesmr) {ib_umem_release (region);kfree (nespbl); -nes_debug (NES_DBG_MR ,"Unable to allocate nesmr\n" );return ERR_PTR (-ENOMEM ); } nesmr->region = region;
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 12/17 IB/mthca: Remove debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/mthca/mthca_reset.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/infiniband/hw/mthca/mthca_reset.c +0 -4
@@ -96,8 +96,6 @@ int mthca_reset(struct mthca_dev *mdev) hca_header =kmalloc (256 ,GFP_KERNEL );if (!hca_header) { err = -ENOMEM ; -mthca_err (mdev,"Couldn't allocate memory to save HCA " -"PCI header, aborting.\n" ); goto put_dev; }
@@ -119,8 +117,6 @@ int mthca_reset(struct mthca_dev *mdev) bridge_header =kmalloc (256 ,GFP_KERNEL );if (!bridge_header) { err = -ENOMEM ; -mthca_err (mdev,"Couldn't allocate memory to save HCA " -"bridge PCI header, aborting.\n" ); goto free_hca; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 13/17 IB/usninc: Remove and fix debug prints after allocation failure
In reply to a message not in the archiveThis patch removes unneeded prints after allocation failure and moves one debug print into the appropriate place.
--- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 10 +--------- drivers/infiniband/hw/usnic/usnic_vnic.c | 22 ++++++---------------- 2 files changed, 7 insertions(+), 25 deletions(-)
drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +1 -9
@@ -228,8 +228,6 @@ create_roce_custom_flow(struct usnic_ib_qp_grp *qp_grp, flow =usnic_fwd_alloc_flow (qp_grp->ufdev, &filter, &uaction);if (IS_ERR_OR_NULL (flow)) { -usnic_err ("Unable to alloc flow failed with err %ld\n" , -PTR_ERR (flow)); err = flow ?PTR_ERR (flow) : -EFAULT ; goto out_unreserve_port; }
@@ -303,8 +301,6 @@ create_udp_flow(struct usnic_ib_qp_grp *qp_grp, flow =usnic_fwd_alloc_flow (qp_grp->ufdev, &filter, &uaction);if (IS_ERR_OR_NULL (flow)) { -usnic_err ("Unable to alloc flow failed with err %ld\n" , -PTR_ERR (flow)); err = flow ?PTR_ERR (flow) : -EFAULT ; goto out_put_sock; }
@@ -694,18 +690,14 @@ usnic_ib_qp_grp_create(struct usnic_fwd_dev *ufdev, struct usnic_ib_vf *vf, } qp_grp =kzalloc (sizeof (*qp_grp),GFP_ATOMIC ); -if (!qp_grp) { -usnic_err ("Unable to alloc qp_grp - Out of memory\n" ); +if (!qp_grp)return NULL ; - } qp_grp->res_chunk_list =alloc_res_chunk_list (vf->vnic, res_spec, qp_grp);if (IS_ERR_OR_NULL (qp_grp->res_chunk_list)) { err = qp_grp->res_chunk_list ?PTR_ERR (qp_grp->res_chunk_list) : -ENOMEM ; -usnic_err ("Unable to alloc res for %d with err %d\n" , - qp_grp->grp_id, err); goto out_free_qp_grp; }
drivers/infiniband/hw/usnic/usnic_vnic.c +6 -16
@@ -241,17 +241,12 @@ usnic_vnic_get_resources(struct usnic_vnic *vnic, enum usnic_vnic_res_type type,return ERR_PTR (-EINVAL ); ret =kzalloc (sizeof (*ret),GFP_ATOMIC ); -if (!ret) { -usnic_err ("Failed to allocate chunk for %s - Out of memory\n" , -usnic_vnic_pci_name (vnic)); +if (!ret)return ERR_PTR (-ENOMEM ); - }if (cnt >0 ) { ret->res =kcalloc (cnt,sizeof (*(ret->res)),GFP_ATOMIC );if (!ret->res) { -usnic_err ("Failed to allocate resources for %s. Out of memory\n" , -usnic_vnic_pci_name (vnic));kfree (ret);return ERR_PTR (-ENOMEM ); }
@@ -311,8 +306,10 @@ static int usnic_vnic_alloc_res_chunk(struct usnic_vnic *vnic,struct usnic_vnic_res *res; cnt =vnic_dev_get_res_count (vnic->vdev,_to_vnic_res_type (type)); -if (cnt <1 ) +if (cnt <1 ) { +usnic_err ("Wrong res count with cnt %d\n" , cnt);return -EINVAL ; + } chunk->cnt = chunk->free_cnt = cnt; chunk->res =kzalloc (sizeof (*(chunk->res))*cnt,GFP_KERNEL );
@@ -384,12 +381,8 @@ static int usnic_vnic_discover_resources(struct pci_dev *pdev, res_type < USNIC_VNIC_RES_TYPE_MAX; res_type++) { err =usnic_vnic_alloc_res_chunk (vnic, res_type, &vnic->chunks[res_type]); -if (err) { -usnic_err ("Failed to alloc res %s with err %d\n" , -usnic_vnic_res_type_to_str (res_type), - err); +if (err) goto out_clean_chunks; - } }return 0 ;
@@ -454,11 +447,8 @@ struct usnic_vnic *usnic_vnic_alloc(struct pci_dev *pdev) } vnic =kzalloc (sizeof (*vnic),GFP_KERNEL ); -if (!vnic) { -usnic_err ("Failed to alloc vnic for %s - out of memory\n" , -pci_name (pdev)); +if (!vnic)return ERR_PTR (-ENOMEM ); - }spin_lock_init (&vnic->res_lock);
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 14/17 IB/ocrdma: Remove and fix debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 5 ++--- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-)
drivers/infiniband/hw/ocrdma/ocrdma_hw.c +2 -3
@@ -1596,10 +1596,9 @@ void ocrdma_alloc_pd_pool(struct ocrdma_dev *dev) dev->pd_mgr =kzalloc (sizeof (struct ocrdma_pd_resource_mgr ),GFP_KERNEL ); -if (!dev->pd_mgr) { -pr_err ("%s(%d)Memory allocation failure.\n" , __func__, dev->id); +if (!dev->pd_mgr)return ; - } + status =ocrdma_mbx_alloc_pd_range (dev);if (status) { pr_err("%s(%d) Unable to initialize PD pool, using default.\n",
drivers/infiniband/hw/ocrdma/ocrdma_stats.c +1 -3
@@ -84,10 +84,8 @@ bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev)/* Alloc debugfs mem */ mem->debugfs_mem =kzalloc (OCRDMA_MAX_DBGFS_MEM ,GFP_KERNEL ); -if (!mem->debugfs_mem) { -pr_err ("%s: stats debugfs mem allocation failed\n" , __func__); +if (!mem->debugfs_mem)return false; - }return true; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 15/17 IB/rxe: Remove and fix debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/sw/rxe/rxe_pool.c | 1 - 1 file changed, 1 deletion(-)
drivers/infiniband/sw/rxe/rxe_pool.c +0 -1
@@ -180,7 +180,6 @@ static int rxe_pool_init_index(struct rxe_pool *pool, u32 max, u32 min) size =BITS_TO_LONGS (max - min +1 ) *sizeof (long ); pool->table =kmalloc (size,GFP_KERNEL );if (!pool->table) { -pr_warn ("no memory for bit table\n" ); err = -ENOMEM ; goto out; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 16/17 IB/isert: Remove and fix debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/ulp/isert/ib_isert.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
drivers/infiniband/ulp/isert/ib_isert.c +6 -17
@@ -184,7 +184,7 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) isert_conn->rx_descs =kzalloc (ISERT_QP_MAX_RECV_DTOS *sizeof (struct iser_rx_desc ),GFP_KERNEL );if (!isert_conn->rx_descs) - goto fail; +return -ENOMEM ; rx_desc = isert_conn->rx_descs;
@@ -213,9 +213,7 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) }kfree (isert_conn->rx_descs); isert_conn->rx_descs =NULL ; -fail:isert_err ("conn %p failed to allocate rx descriptors\n" , isert_conn); -return -ENOMEM ; }
@@ -269,10 +267,8 @@ isert_alloc_comps(struct isert_device *device) device->comps =kcalloc (device->comps_used,sizeof (struct isert_comp ),GFP_KERNEL ); -if (!device->comps) { -isert_err ("Unable to allocate completion contexts\n" ); +if (!device->comps)return -ENOMEM ; - } max_cqe =min (ISER_MAX_CQ_LEN , device->ib_device->attrs.max_cqe);
@@ -432,10 +428,8 @@ isert_alloc_login_buf(struct isert_conn *isert_conn, isert_conn->login_req_buf =kzalloc (sizeof (*isert_conn->login_req_buf),GFP_KERNEL ); -if (!isert_conn->login_req_buf) { -isert_err ("Unable to allocate isert_conn->login_buf\n" ); +if (!isert_conn->login_req_buf)return -ENOMEM ; - } isert_conn->login_req_dma = ib_dma_map_single(ib_dev, isert_conn->login_req_buf,
@@ -1276,11 +1270,8 @@ isert_handle_text_cmd(struct isert_conn *isert_conn, struct isert_cmd *isert_cmdif (payload_length) { text_in =kzalloc (payload_length,GFP_KERNEL ); -if (!text_in) { -isert_err ("Unable to allocate text_in of payload_length: %u\n" , - payload_length); +if (!text_in)return -ENOMEM ; - } } cmd->text_in_ptr = text_in;
@@ -2307,10 +2298,9 @@ isert_setup_np(struct iscsi_np *np,int ret; isert_np =kzalloc (sizeof (struct isert_np ),GFP_KERNEL ); -if (!isert_np) { -isert_err ("Unable to allocate struct isert_np\n" ); +if (!isert_np)return -ENOMEM ; - } +sema_init (&isert_np->sem,0 );mutex_init (&isert_np->mutex);INIT_LIST_HEAD (&isert_np->accepted);
@@ -2651,7 +2641,6 @@ static int __init isert_init(void) WQ_UNBOUND | WQ_HIGHPRI, 0);if (!isert_comp_wq) {isert_err ("Unable to allocate isert_comp_wq\n" ); - ret = -ENOMEM ;return -ENOMEM ; }
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1478184265-9620-17-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Sagi Grimberg
Acked-byRe: [PATCH rdma-next V1 16/17] IB/isert: Remove and fix debug prints after allocation failure
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 17/17 IB/ipoib: Remove and fix debug prints after allocation failure
In reply to a message not in the archiveThe prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway.
--- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 +------- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 5 +---- drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 +---- 3 files changed, 3 insertions(+), 15 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_cm.c +1 -7
@@ -355,11 +355,8 @@ static int ipoib_cm_nonsrq_init_rx(struct net_device *dev, struct ib_cm_id *cm_iint i; rx->rx_ring =vzalloc (ipoib_recvq_size *sizeof *rx->rx_ring); -if (!rx->rx_ring) { -printk (KERN_WARNING "%s: failed to allocate CM non-SRQ ring (%d entries)\n" , - priv->ca->name, ipoib_recvq_size); +if (!rx->rx_ring)return -ENOMEM ; - } t =kmalloc (sizeof *t,GFP_KERNEL );if (!t) {
@@ -1133,7 +1130,6 @@ static int ipoib_cm_tx_init(struct ipoib_cm_tx *p, u32 qpn, p->tx_ring =__vmalloc (ipoib_sendq_size *sizeof *p->tx_ring,GFP_NOIO ,PAGE_KERNEL );if (!p->tx_ring) { -ipoib_warn (priv,"failed to allocate tx ring\n" ); ret = -ENOMEM ; goto err_tx; }
@@ -1549,8 +1545,6 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge) priv->cm.srq_ring =vzalloc (ipoib_recvq_size *sizeof *priv->cm.srq_ring);if (!priv->cm.srq_ring) { -printk (KERN_WARNING "%s: failed to allocate CM SRQ ring (%d entries)\n" , - priv->ca->name, ipoib_recvq_size);ib_destroy_srq (priv->cm.srq); priv->cm.srq =NULL ;return ;
drivers/infiniband/ulp/ipoib/ipoib_ib.c +1 -4
@@ -418,11 +418,8 @@ static void ipoib_ib_handle_tx_wc(struct net_device *dev, struct ib_wc *wc)"(status=%d, wrid=%d vend_err %x)\n" , wc->status, wr_id, wc->vendor_err); qp_work =kzalloc (sizeof (*qp_work),GFP_ATOMIC ); -if (!qp_work) { -ipoib_warn (priv,"%s Failed alloc ipoib_qp_state_validate for qp: 0x%x\n" , - __func__, priv->qp->qp_num); +if (!qp_work)return ; - }INIT_WORK (&qp_work->work, ipoib_qp_state_validate_work); qp_work->priv = priv;
drivers/infiniband/ulp/ipoib/ipoib_main.c +1 -4
@@ -1594,11 +1594,8 @@ int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)/* Allocate RX/TX "rings" to hold queued skbs */ priv->rx_ring =kzalloc (ipoib_recvq_size *sizeof *priv->rx_ring,GFP_KERNEL ); -if (!priv->rx_ring) { -printk (KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n" , - ca->name, ipoib_recvq_size); +if (!priv->rx_ring) goto out; - } priv->tx_ring =vzalloc (ipoib_sendq_size *sizeof *priv->tx_ring);if (!priv->tx_ring) {
Signature · 6 lines
2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 35 lines · Leon Romanovsky
Hi Doug and all,
This is semantic cleanup of infiniband stack from printks immediately after allocation failure. It doesn't get rid from all printks, but only from
the ones which were found by the following grep construction.➜ linux-rdma git:(topic/clean-alloc-prints) grep -rI "[k|v][m|z|c]alloc("
drivers/infiniband/*-A5 | grep "n\""The patchset consists from the 16 almost identical patches and from one fix
which was discovered during the cleanup work.The fix is presented in the patch "IB/core: Release allocated memory in cache setup failure"
Available in the "topic/clean-alloc-prints" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/
?h=topic/clean-alloc-printsCC Sagi Grimberg <[email protected]>CC Ira Weiny <[email protected]>CC Steve Wise <[email protected]>CC Bart Van Assche <[email protected]>CC Faisal Latif <[email protected]>CC Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>CC Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/[email protected]>CC Mike Marciniszyn <[email protected]>CC Dennis Dalessandro <[email protected]>aCC Dave Goodell <[email protected]>
Quoted 2 lines
Changes v0 -> v1:
* Patch 17: Return brackets removed by mistake.
Sorry, I replied to the v0 thread when in fact I applied the v1 patchset.
Signature · 2 lines
Doug Ledford <[email protected]> GPG KeyID: 0E572FDD
ira.weiny
Reviewed-byQuoted 6 lines · Leon Romanovsky
Hi Doug and all,
This is semantic cleanup of infiniband stack from printks immediately after allocation failure. It doesn't get rid from all printks, but only from the ones which were found by the following grep construction.
Quoted 7 lines
➜ linux-rdma git:(topic/clean-alloc-prints) grep -rI "[k|v][m|z|c]alloc("
drivers/infiniband/*-A5 | grep "n\""The patchset consists from the 16 almost identical patches and from one fix which was discovered during the cleanup work.
The fix is presented in the patch "IB/core: Release allocated memory in cache setup failure"
With the exception of other comments the series seems reasonable.
Quoted 82 lines
Available in the "topic/clean-alloc-prints" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/clean-alloc-printsCC Sagi Grimberg <[email protected]>CC Ira Weiny <[email protected]>CC Steve Wise <[email protected]>CC Bart Van Assche <[email protected]>CC Faisal Latif <[email protected]>CC Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/[email protected]>CC Moni Shoua <monis-VPRAkNaXOzVWk0Htik3J/[email protected]>CC Mike Marciniszyn <[email protected]>CC Dennis Dalessandro <[email protected]>aCC Dave Goodell <[email protected]>Changes v0 -> v1:
* Patch 17: Return brackets removed by mistake.Leon Romanovsky (17):
IB/mad: Remove debug prints after allocation failure IB/core: Remove debug prints after allocation failure IB/core: Release allocated memory in cache setup failure IB/mlx4: Remove debug prints after allocation failure IB/mlx5: Remove debug prints after allocation failure IB/hfi1: Remove debug prints after allocation failure IB/cxgb3: Remove debug prints after allocation failure IB/cxgb4: Remove debug prints after allocation failure IB/i40iw: Remove debug prints after allocation failure IB/qib: Remove debug prints after allocation failure IB/nes: Remove debug prints after allocation failure IB/mthca: Remove debug prints after allocation failure IB/usninc: Remove and fix debug prints after allocation failure IB/ocrdma: Remove and fix debug prints after allocation failure IB/rxe: Remove and fix debug prints after allocation failure IB/isert: Remove and fix debug prints after allocation failure IB/ipoib: Remove and fix debug prints after allocation failuredrivers/infiniband/core/agent.c | 1 - drivers/infiniband/core/cache.c | 16 ++++----- drivers/infiniband/core/device.c | 5 +-- drivers/infiniband/core/fmr_pool.c | 1 - drivers/infiniband/core/iwpm_msg.c | 1 - drivers/infiniband/core/iwpm_util.c | 12 +++---- drivers/infiniband/core/mad.c | 40 ++++------------------- drivers/infiniband/core/roce_gid_mgmt.c | 21 ++++-------- drivers/infiniband/hw/cxgb3/cxio_dbg.c | 20 +++++------- drivers/infiniband/hw/cxgb4/device.c | 4 --- drivers/infiniband/hw/hfi1/pio.c | 1 - drivers/infiniband/hw/i40iw/i40iw_cm.c | 2 -- drivers/infiniband/hw/i40iw/i40iw_main.c | 5 ++- drivers/infiniband/hw/i40iw/i40iw_verbs.c | 1 - drivers/infiniband/hw/mlx4/alias_GUID.c | 4 +-- drivers/infiniband/hw/mlx4/cm.c | 4 +-- drivers/infiniband/hw/mlx4/mad.c | 9 ++--- drivers/infiniband/hw/mlx4/main.c | 16 ++------- drivers/infiniband/hw/mlx4/mcg.c | 5 +-- drivers/infiniband/hw/mlx5/srq.c | 2 -- drivers/infiniband/hw/mthca/mthca_reset.c | 4 --- drivers/infiniband/hw/nes/nes.c | 1 - drivers/infiniband/hw/nes/nes_cm.c | 4 +-- drivers/infiniband/hw/nes/nes_hw.c | 6 ++-- drivers/infiniband/hw/nes/nes_mgt.c | 10 ++---- drivers/infiniband/hw/nes/nes_verbs.c | 4 --- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 5 ++- drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 4 +-- drivers/infiniband/hw/qib/qib_diag.c | 6 +--- drivers/infiniband/hw/qib/qib_eeprom.c | 6 +--- drivers/infiniband/hw/qib/qib_iba6120.c | 8 +---- drivers/infiniband/hw/qib/qib_iba7220.c | 8 +---- drivers/infiniband/hw/qib/qib_iba7322.c | 22 +++---------- drivers/infiniband/hw/qib/qib_init.c | 47 +++++---------------------- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 10 +----- drivers/infiniband/hw/usnic/usnic_vnic.c | 22 ++++--------- drivers/infiniband/sw/rxe/rxe_pool.c | 1 - drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 +---- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 5 +-- drivers/infiniband/ulp/ipoib/ipoib_main.c | 5 +-- drivers/infiniband/ulp/isert/ib_isert.c | 23 ++++--------- 41 files changed, 84 insertions(+), 295 deletions(-)
Quoted 3 lines
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html