2017-12-29 19:51:26

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH] wlcore: Delete an error message for a failed memory allocation in three functions

From: Markus Elfring <[email protected]>
Date: Fri, 29 Dec 2017 20:40:49 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/net/wireless/ti/wlcore/main.c | 8 ++------
drivers/net/wireless/ti/wlcore/spi.c | 4 +---
2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index c346c021b999..970e59871547 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1301,10 +1301,8 @@ static struct sk_buff *wl12xx_alloc_dummy_packet(struct wl1271 *wl)
sizeof(struct wl1271_tx_hw_descr) - sizeof(*hdr);

skb = dev_alloc_skb(TOTAL_TX_DUMMY_PACKET_SIZE);
- if (!skb) {
- wl1271_warning("Failed to allocate a dummy packet skb");
+ if (!skb)
return NULL;
- }

skb_reserve(skb, sizeof(struct wl1271_tx_hw_descr));

@@ -1421,10 +1419,8 @@ int wl1271_rx_filter_alloc_field(struct wl12xx_rx_filter *filter,
field = &filter->fields[filter->num_fields];

field->pattern = kzalloc(len, GFP_KERNEL);
- if (!field->pattern) {
- wl1271_warning("Failed to allocate RX filter pattern");
+ if (!field->pattern)
return -ENOMEM;
- }

filter->num_fields++;

diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index 62ce54a949e9..fc94a0d1a01d 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -489,10 +489,8 @@ static int wl1271_probe(struct spi_device *spi)
pdev_data->if_ops = &spi_ops;

glue = devm_kzalloc(&spi->dev, sizeof(*glue), GFP_KERNEL);
- if (!glue) {
- dev_err(&spi->dev, "can't allocate glue\n");
+ if (!glue)
return -ENOMEM;
- }

glue->dev = &spi->dev;

--
2.15.1