[PATCH 10/13] hid: ntrig: zero-initialize ntrig struct
Henrik Rydberg
rydberg at euromail.se
Fri Sep 10 17:14:16 UTC 2010
Setting zeros using kzalloc instead.
Signed-off-by: Henrik Rydberg <rydberg at euromail.se>
---
drivers/hid/hid-ntrig.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
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);
--
1.7.1
More information about the kernel-team
mailing list