linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "ira.weiny" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH rdma-next V1 01/17] IB/mad: Remove debug prints after allocation failure
Date: Thu, 15 Dec 2016 22:43:09 -0500	[thread overview]
Message-ID: <20161216034308.GB12582@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <1478184265-9620-2-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

On Thu, Nov 03, 2016 at 04:44:09PM +0200, Leon Romanovsky wrote:
> 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 <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

Reviewed-by: Ira Weiny <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

> ---
>  drivers/infiniband/core/mad.c | 40 ++++++----------------------------------
>  1 file changed, 6 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
> index 40cbd6b..dadce12 100644
> --- a/drivers/infiniband/core/mad.c
> +++ b/drivers/infiniband/core/mad.c
> @@ -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;
> -- 
> 2.7.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-12-16  3:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 14:44 [PATCH rdma-next V1 00/17] Remove debug prints after allocation failure Leon Romanovsky
     [not found] ` <1478184265-9620-1-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-11-03 14:44   ` [PATCH rdma-next V1 01/17] IB/mad: " Leon Romanovsky
     [not found]     ` <1478184265-9620-2-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-12-16  3:43       ` ira.weiny [this message]
2016-11-03 14:44   ` [PATCH rdma-next V1 02/17] IB/core: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 03/17] IB/core: Release allocated memory in cache setup failure Leon Romanovsky
     [not found]     ` <1478184265-9620-4-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-12-16  3:42       ` ira.weiny
     [not found]         ` <20161216034218.GA12582-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2016-12-16  4:27           ` Jason Gunthorpe
     [not found]             ` <20161216042743.GD3797-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-12-18  7:41               ` Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 04/17] IB/mlx4: Remove debug prints after allocation failure Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 05/17] IB/mlx5: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 06/17] IB/hfi1: " Leon Romanovsky
     [not found]     ` <1478184265-9620-7-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-11-12  4:04       ` Dalessandro, Dennis
     [not found]         ` <1478923438.2458.9.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-12-03 18:31           ` Doug Ledford
2016-11-03 14:44   ` [PATCH rdma-next V1 07/17] IB/cxgb3: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 08/17] IB/cxgb4: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 09/17] IB/i40iw: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 10/17] IB/qib: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 11/17] IB/nes: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 12/17] IB/mthca: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 13/17] IB/usninc: Remove and fix " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 14/17] IB/ocrdma: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 15/17] IB/rxe: " Leon Romanovsky
2016-11-03 14:44   ` [PATCH rdma-next V1 16/17] IB/isert: " Leon Romanovsky
     [not found]     ` <1478184265-9620-17-git-send-email-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-11-03 21:24       ` Sagi Grimberg
2016-11-03 14:44   ` [PATCH rdma-next V1 17/17] IB/ipoib: " Leon Romanovsky
2016-12-03 18:30   ` [PATCH rdma-next V1 00/17] Remove " Doug Ledford
2016-12-16  4:04   ` ira.weiny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161216034308.GB12582@phlsvsds.ph.intel.com \
    --to=ira.weiny-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).