From: toddpoynor@google.com (Todd Poynor)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v14 05/12] OMAP: dmtimer: platform driver
Date: Mon, 11 Jul 2011 16:10:55 -0700 [thread overview]
Message-ID: <20110711231055.GA8312@google.com> (raw)
In-Reply-To: <1310383759-19059-6-git-send-email-tarun.kanti@ti.com>
On Mon, Jul 11, 2011 at 04:59:12PM +0530, Tarun Kanti DebBarma wrote:
> Add dmtimer platform driver functions which include:
> (1) platform driver initialization
> (2) driver probe function
> (3) driver remove function
>
...
> + timer = kzalloc(sizeof(struct omap_dm_timer), GFP_KERNEL);
> + if (!timer) {
> + dev_err(&pdev->dev, "%s: no memory for omap_dm_timer.\n",
> + __func__);
> + ret = -ENOMEM;
> + goto err_release_ioregion;
> + }
> +
> + timer->io_base = ioremap(mem->start, resource_size(mem));
> + if (!timer->io_base) {
> + dev_err(&pdev->dev, "%s: ioremap failed.\n", __func__);
> + ret = -ENOMEM;
> + goto err_free_mem;
> + }
> +
> + if (pdata->timer_ip_type == OMAP_TIMER_IP_VERSION_2) {
> + timer->func_offset = VERSION2_TIMER_WAKEUP_EN_REG_OFFSET;
> + timer->intr_offset = VERSION2_TIMER_STAT_REG_OFFSET;
> + } else {
> + timer->func_offset = 0;
> + timer->intr_offset = 0;
Don't need to init kzalloc'ed fields to zero.
> + }
> +
> + timer->id = pdev->id;
> + timer->irq = irq->start;
> + timer->pdev = pdev;
> + timer->reserved = 0;
And here.
> +err_free_pdev:
> + kfree(pdata);
pdata wasn't allocated here, shouldn't be freed here.
> + platform_device_unregister(pdev);
The platform device wasn't registered here.
...
> +static int __devexit omap_dm_timer_remove(struct platform_device *pdev)
> +{
> + struct omap_dm_timer *timer, *tmp;
> + unsigned long flags;
> + int ret = -EINVAL;
> +
> + spin_lock_irqsave(&dm_timer_lock, flags);
> + list_for_each_entry_safe(timer, tmp, &omap_timer_list, node) {
Don't need list_for_each_entry_safe, you have the lock protecting list
modifications held and IRQs off.
> + if (timer->pdev->id == pdev->id) {
> + kfree(timer->pdev->dev.platform_data);
Not allocated by this driver.
> + platform_device_del(timer->pdev);
Not added by this driver.
> + list_del(&timer->node);
> + kfree(timer);
Todd
next prev parent reply other threads:[~2011-07-11 23:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 11:29 [PATCH v14 00/12] dmtimer adaptation to platform_driver Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 01/12] OMAP2+: dmtimer: add device names to flck nodes Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 02/12] OMAP4: hwmod data: add dmtimer version information Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 03/12] OMAP1: dmtimer: conversion to platform devices Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 04/12] OMAP2+: dmtimer: convert " Tarun Kanti DebBarma
2011-07-11 23:19 ` Todd Poynor
2011-07-11 23:29 ` DebBarma, Tarun Kanti
2011-07-11 11:29 ` [PATCH v14 05/12] OMAP: dmtimer: platform driver Tarun Kanti DebBarma
2011-07-11 23:10 ` Todd Poynor [this message]
2011-07-11 23:27 ` DebBarma, Tarun Kanti
2011-07-11 11:29 ` [PATCH v14 06/12] OMAP: dmtimer: switch-over to platform device driver Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 07/12] OMAP: dmtimer: pm_runtime support Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 08/12] OMAP: dmtimer: add timeout to low-level routines Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 09/12] OMAP: dmtimer: use mutex instead of spinlock Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 10/12] OMAP: dmtimer: mark clocksource and clockevent timers reserved Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 11/12] OMAP: dmtimer: add context save/restore routines Tarun Kanti DebBarma
2011-07-11 11:29 ` [PATCH v14 12/12] OMAP: dmtimer: Off mode support Tarun Kanti DebBarma
-- strict thread matches above, loose matches on Subject: below --
2011-07-11 11:21 [PATCH v14 00/12] dmtimer adaptation to platform_driver Tarun Kanti DebBarma
2011-07-11 11:21 ` [PATCH v14 05/12] OMAP: dmtimer: platform driver Tarun Kanti DebBarma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110711231055.GA8312@google.com \
--to=toddpoynor@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox