linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: netdev@vger.kernel.org
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>,
	linux-wimax@intel.com, wimax@linuxwimax.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 6/8] wimax: Remove unnecessary alloc/OOM messages, alloc cleanups
Date: Sun,  3 Feb 2013 19:28:13 -0800	[thread overview]
Message-ID: <77a7656d109fba0ad4f55e0adafe770d38d588c9.1359939013.git.joe@perches.com> (raw)
In-Reply-To: <cover.1359939012.git.joe@perches.com>

alloc failures already get standardized OOM
messages and a dump_stack.

Convert kzalloc's with multiplies to kcalloc.
Remove now unused size variables.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wimax/i2400m/rx.c        | 16 +++++-----------
 drivers/net/wimax/i2400m/usb-notif.c |  1 -
 2 files changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wimax/i2400m/rx.c b/drivers/net/wimax/i2400m/rx.c
index 37becfc..8077e6e 100644
--- a/drivers/net/wimax/i2400m/rx.c
+++ b/drivers/net/wimax/i2400m/rx.c
@@ -1351,24 +1351,18 @@ int i2400m_rx_setup(struct i2400m *i2400m)
 	i2400m->rx_reorder = i2400m_rx_reorder_disabled? 0 : 1;
 	if (i2400m->rx_reorder) {
 		unsigned itr;
-		size_t size;
 		struct i2400m_roq_log *rd;
 
 		result = -ENOMEM;
 
-		size = sizeof(i2400m->rx_roq[0]) * (I2400M_RO_CIN + 1);
-		i2400m->rx_roq = kzalloc(size, GFP_KERNEL);
-		if (i2400m->rx_roq == NULL) {
-			dev_err(dev, "RX: cannot allocate %zu bytes for "
-				"reorder queues\n", size);
+		i2400m->rx_roq = kcalloc(I2400M_RO_CIN + 1,
+					 sizeof(i2400m->rx_roq[0]), GFP_KERNEL);
+		if (i2400m->rx_roq == NULL)
 			goto error_roq_alloc;
-		}
 
-		size = sizeof(*i2400m->rx_roq[0].log) * (I2400M_RO_CIN + 1);
-		rd = kzalloc(size, GFP_KERNEL);
+		rd = kcalloc(I2400M_RO_CIN + 1, sizeof(*i2400m->rx_roq[0].log),
+			     GFP_KERNEL);
 		if (rd == NULL) {
-			dev_err(dev, "RX: cannot allocate %zu bytes for "
-				"reorder queues log areas\n", size);
 			result = -ENOMEM;
 			goto error_roq_log_alloc;
 		}
diff --git a/drivers/net/wimax/i2400m/usb-notif.c b/drivers/net/wimax/i2400m/usb-notif.c
index d44b545..fc1355d 100644
--- a/drivers/net/wimax/i2400m/usb-notif.c
+++ b/drivers/net/wimax/i2400m/usb-notif.c
@@ -199,7 +199,6 @@ int i2400mu_notification_setup(struct i2400mu *i2400mu)
 	d_fnstart(4, dev, "(i2400m %p)\n", i2400mu);
 	buf = kmalloc(I2400MU_MAX_NOTIFICATION_LEN, GFP_KERNEL | GFP_DMA);
 	if (buf == NULL) {
-		dev_err(dev, "notification: buffer allocation failed\n");
 		ret = -ENOMEM;
 		goto error_buf_alloc;
 	}
-- 
1.8.0.dirty


  parent reply	other threads:[~2013-02-04  3:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04  3:28 [PATCH 0/8] drivers/net: Remove unnecessary alloc/OOM messages Joe Perches
2013-02-04  3:28 ` [PATCH 1/8] caif: " Joe Perches
2013-02-04  3:28 ` [PATCH 2/8] can: " Joe Perches
2013-02-04  9:02   ` Marc Kleine-Budde
2013-02-04  3:28 ` [PATCH 4/8] drivers: net: usb: " Joe Perches
2013-02-04  3:28 ` [PATCH 5/8] wan: " Joe Perches
2013-02-10 20:30   ` Krzysztof Halasa
2013-02-04  3:28 ` Joe Perches [this message]
2013-02-04  3:28 ` [PATCH 7/8] wireless: Remove unnecessary alloc/OOM messages, alloc cleanups Joe Perches
2013-02-04  3:28 ` [PATCH 8/8] drivers:net:misc: Remove unnecessary alloc/OOM messages Joe Perches
2013-02-07  4:08   ` Rusty Russell
2013-02-04  3:43 ` [PATCH 3/8] ethernet: Remove unnecessary alloc/OOM messages, alloc cleanups Joe Perches
2013-02-04 18:23 ` [PATCH 0/8] drivers/net: Remove unnecessary alloc/OOM messages David Miller
2013-02-05  2:48   ` [PATCH] net: core: " Joe Perches
2013-02-06 20:02     ` David Miller

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=77a7656d109fba0ad4f55e0adafe770d38d588c9.1359939013.git.joe@perches.com \
    --to=joe@perches.com \
    --cc=inaky.perez-gonzalez@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wimax@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=wimax@linuxwimax.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).