Skip to contentSkip to conversation

iio/orientation: Delete an error message for a failed memory allocation in two functions

PATCH In review SF Markus Elfring 2 participants 2 messages Jan 29, 2018 – Feb 4, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio/orientation: Delete an error message for a failed memory allocation in two functions

From: Markus Elfring <[email protected]>
Date: Mon, 29 Jan 2018 22:20:07 +0100

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

This issue was detected by using the Coccinelle software.

---
 drivers/iio/orientation/hid-sensor-incl-3d.c  | 4 +---
 drivers/iio/orientation/hid-sensor-rotation.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/iio/orientation/hid-sensor-incl-3d.c +1 -3
index 1e5451d1ff88..742c0e0eb4cf 100644
@@ -336,10 +336,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
 
 	indio_dev->channels = kmemdup(incl_3d_channels,
 				      sizeof(incl_3d_channels), GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = incl_3d_parse_report(pdev, hsdev,
 				   (struct iio_chan_spec *)indio_dev->channels,
drivers/iio/orientation/hid-sensor-rotation.c +1 -3
index a69db2002414..cbf5e406b1ee 100644
@@ -277,10 +277,8 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
 	indio_dev->channels = devm_kmemdup(&pdev->dev, dev_rot_channels,
 					   sizeof(dev_rot_channels),
 					   GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = dev_rot_parse_report(pdev, hsdev,
 				   (struct iio_chan_spec *)indio_dev->channels,
Signature · 1 line
2.16.1
maintainer
#1 lore raw
Quoted 8 lines · On Mon, 29 Jan 2018 22:26:15 +0100 SF Markus Elfring…

From: Markus Elfring <[email protected]>
Date: Mon, 29 Jan 2018 22:20:07 +0100

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

This issue was detected by using the Coccinelle software.

Same response as previous patch - it might not be adding much information, but it is adding some so we should keep it.

Jonathan

Quoted 37 lines
---
 drivers/iio/orientation/hid-sensor-incl-3d.c  | 4 +---
 drivers/iio/orientation/hid-sensor-rotation.c | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
drivers/iio/orientation/hid-sensor-incl-3d.c +1 -3
index 1e5451d1ff88..742c0e0eb4cf 100644
@@ -336,10 +336,8 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
 
 	indio_dev->channels = kmemdup(incl_3d_channels,
 				      sizeof(incl_3d_channels), GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = incl_3d_parse_report(pdev, hsdev,
 				   (struct iio_chan_spec *)indio_dev->channels,
drivers/iio/orientation/hid-sensor-rotation.c +1 -3
index a69db2002414..cbf5e406b1ee 100644
@@ -277,10 +277,8 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
 	indio_dev->channels = devm_kmemdup(&pdev->dev, dev_rot_channels,
 					   sizeof(dev_rot_channels),
 					   GFP_KERNEL);
-	if (!indio_dev->channels) {
-		dev_err(&pdev->dev, "failed to duplicate channels\n");
+	if (!indio_dev->channels)
 		return -ENOMEM;
-	}
 
 	ret = dev_rot_parse_report(pdev, hsdev,
 				   (struct iio_chan_spec *)indio_dev->channels,