Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1629974

[PATCH 2/7] HID: sensor-hub: Delete error messages for failed memory allocations in sensor_hub_probe()

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/7] HID: sensor-hub: Delete error messages for failed memory allocations in sensor_hub_probe()
Date 2017-04-24 22:20 +0200
Message-ID <tzSCL-37e-39@gated-at.bofh.it> (permalink)
References <tzSCL-37e-27@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 24 Apr 2017 19:45:25 +0200

The script "checkpatch.pl" pointed information out like the following.

WARNING: Possible unnecessary 'out of memory' message

Thus remove such statements here.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hid/hid-sensor-hub.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c
index 349494fc8def..feb4bb8ee3ec 100644
--- a/drivers/hid/hid-sensor-hub.c
+++ b/drivers/hid/hid-sensor-hub.c
@@ -640,10 +640,8 @@ static int sensor_hub_probe(struct hid_device *hdev,
 	struct hid_sensor_hub_device *collection_hsdev = NULL;
 
 	sd = devm_kzalloc(&hdev->dev, sizeof(*sd), GFP_KERNEL);
-	if (!sd) {
-		hid_err(hdev, "cannot allocate Sensor data\n");
+	if (!sd)
 		return -ENOMEM;
-	}
 
 	hid_set_drvdata(hdev, sd);
 	sd->quirks = id->driver_data;
@@ -678,7 +676,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
 			       sizeof(*sd->hid_sensor_hub_client_devs),
 			       GFP_KERNEL);
 	if (sd->hid_sensor_hub_client_devs == NULL) {
-		hid_err(hdev, "Failed to allocate memory for mfd cells\n");
 		ret = -ENOMEM;
 		goto err_stop_hw;
 	}
@@ -692,7 +689,6 @@ static int sensor_hub_probe(struct hid_device *hdev,
 			hsdev = devm_kzalloc(&hdev->dev, sizeof(*hsdev),
 					     GFP_KERNEL);
 			if (!hsdev) {
-				hid_err(hdev, "cannot allocate hid_sensor_hub_device\n");
 				ret = -ENOMEM;
 				goto err_stop_hw;
 			}
-- 
2.12.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/7] HID: Fine-tuning for some function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:20 +0200
  [PATCH 3/7] HID: sensor-hub: Adjust two checks for null pointers in  sensor_hub_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:20 +0200
  [PATCH 1/7] HID: sensor-hub: Use devm_kcalloc() in sensor_hub_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:20 +0200
  [PATCH 2/7] HID: sensor-hub: Delete error messages for failed memory  allocations in sensor_hub_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:20 +0200
    Re: HID: sensor-hub: Delete error messages for failed memory  allocations in sensor_hub_probe() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-27 20:20 +0200
  [PATCH 7/7] HID: picoLCD: Replace two seq_printf() calls by  seq_puts() in picolcd_debug_reset_show() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:30 +0200
    Re: [PATCH 7/7] HID: picoLCD: Replace two seq_printf() calls by  seq_puts() in picolcd_debug_reset_show() Bruno Prémont <bonbons@linux-vserver.org> - 2017-04-25 09:00 +0200
  [PATCH 5/7] HID: debug: Replace 12 seq_printf() calls by seq_puts() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:30 +0200
  [PATCH 6/7] HID: debug: Combine two seq_printf() calls into one call  in hid_dump_device() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:30 +0200
  [PATCH 4/7] HID: debug: Replace five seq_printf() calls by seq_putc() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-24 22:30 +0200

csiph-web