All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] Input: synaptics-rmi4 - do not kfree() managed memory in F01
@ 2014-02-13  5:27 Dmitry Torokhov
  2014-02-13  5:27 ` [PATCH 02/11] Input: synaptics-rmi4 - remove unused rmi_f01_remove() Dmitry Torokhov
                   ` (10 more replies)
  0 siblings, 11 replies; 28+ messages in thread
From: Dmitry Torokhov @ 2014-02-13  5:27 UTC (permalink / raw)
  To: Christopher Heiny
  Cc: Andrew Duggan, Vincent Huang, Vivian Ly, Daniel Rosenberg,
	Linus Walleij, Benjamin Tissoires, Courtney Cavin, Linux Input,
	Linux Kernel

Data that is allocated with devm_kzalloc() should not be freed with
kfree(). In fact, we should rely on the fact that memory is managed and let
devres core free it for us.

Reported-by: Courtney Cavin <courtney.cavin@sonymobile.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/rmi4/rmi_f01.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 381ad60..92b90d1 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -272,7 +272,7 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 	if (error < 0) {
 		dev_err(&fn->dev,
 			"Failed to read F01 control interrupt enable register.\n");
-		goto error_exit;
+		return error;
 	}
 
 	ctrl_base_addr += data->num_of_irq_regs;
@@ -307,14 +307,14 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 					data->device_control.doze_interval);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to configure F01 doze interval register.\n");
-				goto error_exit;
+				return error;
 			}
 		} else {
 			error = rmi_read(rmi_dev, data->doze_interval_addr,
 					&data->device_control.doze_interval);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to read F01 doze interval register.\n");
-				goto error_exit;
+				return error;
 			}
 		}
 
@@ -328,14 +328,14 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 					data->device_control.wakeup_threshold);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to configure F01 wakeup threshold register.\n");
-				goto error_exit;
+				return error;
 			}
 		} else {
 			error = rmi_read(rmi_dev, data->wakeup_threshold_addr,
 					&data->device_control.wakeup_threshold);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to read F01 wakeup threshold register.\n");
-				goto error_exit;
+				return error;
 			}
 		}
 	}
@@ -351,14 +351,14 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 					data->device_control.doze_holdoff);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to configure F01 doze holdoff register.\n");
-				goto error_exit;
+				return error;
 			}
 		} else {
 			error = rmi_read(rmi_dev, data->doze_holdoff_addr,
 					&data->device_control.doze_holdoff);
 			if (error < 0) {
 				dev_err(&fn->dev, "Failed to read F01 doze holdoff register.\n");
-				goto error_exit;
+				return error;
 			}
 		}
 	}
@@ -367,22 +367,17 @@ static int rmi_f01_initialize(struct rmi_function *fn)
 		&data->device_status, sizeof(data->device_status));
 	if (error < 0) {
 		dev_err(&fn->dev, "Failed to read device status.\n");
-		goto error_exit;
+		return error;
 	}
 
 	if (RMI_F01_STATUS_UNCONFIGURED(data->device_status)) {
 		dev_err(&fn->dev,
 			"Device was reset during configuration process, status: %#02x!\n",
 			RMI_F01_STATUS_CODE(data->device_status));
-		error = -EINVAL;
-		goto error_exit;
+		return -EINVAL;
 	}
 
 	return 0;
-
- error_exit:
-	kfree(data);
-	return error;
 }
 
 static int rmi_f01_config(struct rmi_function *fn)
-- 
1.8.5.3


^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2014-03-19  0:21 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-13  5:27 [PATCH 01/11] Input: synaptics-rmi4 - do not kfree() managed memory in F01 Dmitry Torokhov
2014-02-13  5:27 ` [PATCH 02/11] Input: synaptics-rmi4 - remove unused rmi_f01_remove() Dmitry Torokhov
2014-02-13 19:11   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 03/11] Input: synaptics-rmi4 - do not update configuration in rmi_f01_probe() Dmitry Torokhov
2014-02-13 19:23   ` Christopher Heiny
2014-02-13 21:54     ` Dmitry Torokhov
2014-02-14 23:00       ` Christopher Heiny
2014-02-17 19:23         ` Dmitry Torokhov
2014-02-18 21:32           ` Christopher Heiny
2014-03-19  0:21   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 04/11] Input: synaptics-rmi4 - fix LTS handling in F01 Dmitry Torokhov
2014-02-13 19:32   ` Christopher Heiny
2014-02-14  8:05     ` Dmitry Torokhov
2014-02-13  5:27 ` [PATCH 05/11] Input: synaptics-rmi4 - remove control_mutex from f01_data Dmitry Torokhov
2014-02-13 23:01   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 06/11] Input: synaptics-rmi4 - remove device_status form f01_data Dmitry Torokhov
2014-02-13 21:15   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 07/11] Input: synaptics-rmi4 - rename instances of f01_data from data to f01 Dmitry Torokhov
2014-02-13 21:32   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 08/11] Input: synaptics-rmi4 - use rmi_read/rmi_write in F01 Dmitry Torokhov
2014-02-13 21:33   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 09/11] Input: synaptics-rmi4 - consolidate memory allocations " Dmitry Torokhov
2014-02-13 19:52   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 10/11] Input: synaptics-rmi4 - make accessor for platform data return const pointer Dmitry Torokhov
2014-02-13 20:00   ` Christopher Heiny
2014-02-13  5:27 ` [PATCH 11/11] Input: synaptics-rmi4 - remove data pointer from RMI fucntion structure Dmitry Torokhov
2014-02-13 21:33   ` Christopher Heiny
2014-02-13 19:11 ` [PATCH 01/11] Input: synaptics-rmi4 - do not kfree() managed memory in F01 Christopher Heiny

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.