Commit b262bc74 authored by Laurent Pinchart's avatar Laurent Pinchart

clocksource: sh_cmt: Replace kmalloc + memset with kzalloc

One kzalloc a day keeps the bugs away.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
parent 740a9518
...@@ -672,8 +672,6 @@ static void sh_cmt_register_clockevent(struct sh_cmt_channel *ch, ...@@ -672,8 +672,6 @@ static void sh_cmt_register_clockevent(struct sh_cmt_channel *ch,
{ {
struct clock_event_device *ced = &ch->ced; struct clock_event_device *ced = &ch->ced;
memset(ced, 0, sizeof(*ced));
ced->name = name; ced->name = name;
ced->features = CLOCK_EVT_FEAT_PERIODIC; ced->features = CLOCK_EVT_FEAT_PERIODIC;
ced->features |= CLOCK_EVT_FEAT_ONESHOT; ced->features |= CLOCK_EVT_FEAT_ONESHOT;
...@@ -709,7 +707,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index, ...@@ -709,7 +707,6 @@ static int sh_cmt_setup_channel(struct sh_cmt_channel *ch, unsigned int index,
int irq; int irq;
int ret; int ret;
memset(ch, 0, sizeof(*ch));
ch->cmt = cmt; ch->cmt = cmt;
ch->base = cmt->mapbase_ch; ch->base = cmt->mapbase_ch;
ch->index = index; ch->index = index;
...@@ -758,7 +755,6 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev) ...@@ -758,7 +755,6 @@ static int sh_cmt_setup(struct sh_cmt_device *cmt, struct platform_device *pdev)
int ret; int ret;
ret = -ENXIO; ret = -ENXIO;
memset(cmt, 0, sizeof(*cmt));
cmt->pdev = pdev; cmt->pdev = pdev;
if (!cfg) { if (!cfg) {
...@@ -861,7 +857,7 @@ static int sh_cmt_probe(struct platform_device *pdev) ...@@ -861,7 +857,7 @@ static int sh_cmt_probe(struct platform_device *pdev)
goto out; goto out;
} }
cmt = kmalloc(sizeof(*cmt), GFP_KERNEL); cmt = kzalloc(sizeof(*cmt), GFP_KERNEL);
if (cmt == NULL) { if (cmt == NULL) {
dev_err(&pdev->dev, "failed to allocate driver data\n"); dev_err(&pdev->dev, "failed to allocate driver data\n");
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment