All of lore.kernel.org
 help / color / mirror / Atom feed
From: hjk@hansjkoch.de (Hans J. Koch)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/2] PRUSS UIO driver support
Date: Wed, 23 Feb 2011 18:37:25 +0100	[thread overview]
Message-ID: <20110223173724.GA2801@local> (raw)
In-Reply-To: <1298469161-7644-2-git-send-email-pratheesh@ti.com>

On Wed, Feb 23, 2011 at 07:22:40PM +0530, Pratheesh Gangadhar wrote:
> This patch implements PRUSS (Programmable Real-time Unit Sub System)
> UIO driver which exports SOC resources associated with PRUSS like
> I/O, memories and IRQs to user space. PRUSS is dual 32-bit RISC
> processors which is efficient in performing embedded tasks that
> require manipulation of packed memory mapped data structures and
> efficient in handling system events that have tight real time
> constraints. This driver is currently supported on Texas Instruments
> DA850, AM18xx and OMAPL1-38 devices.
> For example, PRUSS runs firmware for real-time critical industrial
> communication data link layer and communicates with application stack
> running in user space via shared memory and IRQs.
> 
> Signed-off-by: Pratheesh Gangadhar <pratheesh@ti.com>
> ---
>  drivers/uio/Kconfig     |   17 ++++
>  drivers/uio/Makefile    |    1 +
>  drivers/uio/uio_pruss.c |  223 +++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 241 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/uio/uio_pruss.c
> 

[...]

> +
> +static int __devinit pruss_probe(struct platform_device *dev)
> +{
> +	int ret = -ENODEV, count = 0;
> +	struct resource *regs_prussio, *regs_l3ram, *regs_ddr;
> +	struct uio_info *p;
> +
> +	info = kzalloc(sizeof(struct uio_info) * MAX_PRUSS_EVTOUT_INSTANCE,
> +		       GFP_KERNEL);
> +	if (!info)
> +		return -ENOMEM;
> +
> +	/* Power on PRU in case its not done as part of boot-loader */
> +	pruss_clk = clk_get(&dev->dev, "pruss");
> +	if (IS_ERR(pruss_clk)) {
> +		dev_err(&dev->dev, "Failed to get clock\n");
> +		ret = PTR_ERR(pruss_clk);
> +		return ret;

You leak memory here. What about freeing "info"?

> +	} else {
> +		clk_enable(pruss_clk);
> +	}

Thanks,
Hans

WARNING: multiple messages have this Message-ID (diff)
From: "Hans J. Koch" <hjk@hansjkoch.de>
To: Pratheesh Gangadhar <pratheesh@ti.com>
Cc: davinci-linux-open-source@linux.davincidsp.com, hjk@hansjkoch.de,
	gregkh@suse.de, amit.chatterjee@ti.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 1/2] PRUSS UIO driver support
Date: Wed, 23 Feb 2011 18:37:25 +0100	[thread overview]
Message-ID: <20110223173724.GA2801@local> (raw)
In-Reply-To: <1298469161-7644-2-git-send-email-pratheesh@ti.com>

On Wed, Feb 23, 2011 at 07:22:40PM +0530, Pratheesh Gangadhar wrote:
> This patch implements PRUSS (Programmable Real-time Unit Sub System)
> UIO driver which exports SOC resources associated with PRUSS like
> I/O, memories and IRQs to user space. PRUSS is dual 32-bit RISC
> processors which is efficient in performing embedded tasks that
> require manipulation of packed memory mapped data structures and
> efficient in handling system events that have tight real time
> constraints. This driver is currently supported on Texas Instruments
> DA850, AM18xx and OMAPL1-38 devices.
> For example, PRUSS runs firmware for real-time critical industrial
> communication data link layer and communicates with application stack
> running in user space via shared memory and IRQs.
> 
> Signed-off-by: Pratheesh Gangadhar <pratheesh@ti.com>
> ---
>  drivers/uio/Kconfig     |   17 ++++
>  drivers/uio/Makefile    |    1 +
>  drivers/uio/uio_pruss.c |  223 +++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 241 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/uio/uio_pruss.c
> 

[...]

> +
> +static int __devinit pruss_probe(struct platform_device *dev)
> +{
> +	int ret = -ENODEV, count = 0;
> +	struct resource *regs_prussio, *regs_l3ram, *regs_ddr;
> +	struct uio_info *p;
> +
> +	info = kzalloc(sizeof(struct uio_info) * MAX_PRUSS_EVTOUT_INSTANCE,
> +		       GFP_KERNEL);
> +	if (!info)
> +		return -ENOMEM;
> +
> +	/* Power on PRU in case its not done as part of boot-loader */
> +	pruss_clk = clk_get(&dev->dev, "pruss");
> +	if (IS_ERR(pruss_clk)) {
> +		dev_err(&dev->dev, "Failed to get clock\n");
> +		ret = PTR_ERR(pruss_clk);
> +		return ret;

You leak memory here. What about freeing "info"?

> +	} else {
> +		clk_enable(pruss_clk);
> +	}

Thanks,
Hans


  parent reply	other threads:[~2011-02-23 17:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 13:52 [PATCH v3 0/2] Add PRUSS UIO driver support Pratheesh Gangadhar
2011-02-23 13:52 ` Pratheesh Gangadhar
2011-02-23 13:52 ` [PATCH v3 1/2] " Pratheesh Gangadhar
2011-02-23 13:52   ` Pratheesh Gangadhar
2011-02-23 13:52   ` [PATCH v3 2/2] Defines DA850/AM18xx/OMAPL1-38 SOC resources used by PRUSS UIO driver Pratheesh Gangadhar
2011-02-23 13:52     ` Pratheesh Gangadhar
2011-02-23 17:37   ` Hans J. Koch [this message]
2011-02-23 17:37     ` [PATCH v3 1/2] PRUSS UIO driver support Hans J. Koch
2011-02-24 13:56     ` TK, Pratheesh Gangadhar
2011-02-24 13:56       ` TK, Pratheesh Gangadhar
2011-02-23 20:25   ` Thomas Gleixner
2011-02-23 20:25     ` Thomas Gleixner
2011-02-23 20:49     ` Sergei Shtylyov
2011-02-23 20:49       ` Sergei Shtylyov
2011-02-23 20:54       ` Thomas Gleixner
2011-02-23 20:54         ` Thomas Gleixner
2011-02-24 13:55         ` TK, Pratheesh Gangadhar
2011-02-24 13:55           ` TK, Pratheesh Gangadhar
2011-02-24 13:54     ` TK, Pratheesh Gangadhar
2011-02-24 13:54       ` TK, Pratheesh Gangadhar

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=20110223173724.GA2801@local \
    --to=hjk@hansjkoch.de \
    --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 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.