Patchwork [10/13] hid: ntrig: zero-initialize ntrig struct

login
register
mail settings
Submitter Henrik Rydberg
Date Sept. 10, 2010, 5:14 p.m.
Message ID <1284138859-32673-11-git-send-email-rydberg@euromail.se>
Download mbox | patch
Permalink /patch/64434/
State Accepted
Delegated to: Leann Ogasawara
Headers show

Comments

Henrik Rydberg - Sept. 10, 2010, 5:14 p.m.
Setting zeros using kzalloc instead.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/hid/hid-ntrig.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

Patch

diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
index 403503c..fbb68d2 100644
--- a/drivers/hid/hid-ntrig.c
+++ b/drivers/hid/hid-ntrig.c
@@ -482,23 +482,15 @@  static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	if (id->driver_data & NTRIG_DUPLICATE_USAGES)
 		hdev->quirks |= HID_QUIRK_MULTI_INPUT;
 
-	nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL);
+	nd = kzalloc(sizeof(struct ntrig_data), GFP_KERNEL);
 	if (!nd) {
 		dev_err(&hdev->dev, "cannot allocate N-Trig data\n");
 		return -ENOMEM;
 	}
 
-	nd->reading_mt = 0;
-	nd->min_width = 0;
-	nd->min_height = 0;
 	nd->activate_slack = activate_slack;
 	nd->act_state = activate_slack;
 	nd->deactivate_slack = -deactivate_slack;
-	nd->sensor_logical_width = 0;
-	nd->sensor_logical_height = 0;
-	nd->sensor_physical_width = 0;
-	nd->sensor_physical_height = 0;
-
 	hid_set_drvdata(hdev, nd);
 
 	ret = hid_parse(hdev);