From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Paul Sokolovsky <pmiscml@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC, PATCH 1/4] SoC base drivers: SoC helper API
Date: Tue, 1 May 2007 20:08:03 +0100 [thread overview]
Message-ID: <20070501190803.GB19872@flint.arm.linux.org.uk> (raw)
In-Reply-To: <181733600.20070501080827@gmail.com>
On Tue, May 01, 2007 at 08:08:27AM +0300, Paul Sokolovsky wrote:
> +void soc_free_devices(struct platform_device *devices, int nr_devs)
> +{
> + struct platform_device *dev = devices;
> + int i;
> +
> + for (i = 0; i < nr_devs; i++) {
> + struct resource *res = dev->resource;
> + platform_device_unregister(dev++);
> + kfree(res);
> + }
> + kfree(devices);
Utterly unsafe. Repeat after me: kfreeing the memory assocated with any
kobject is asking for an OOPS. Do not do it.
There's a reason that platform_device_alloc() and friends exist. If you
want to unregister platform devices, use those functions. Don't try to
invent your own buggy variants.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
prev parent reply other threads:[~2007-05-01 19:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-01 5:08 Paul Sokolovsky
2007-05-01 6:56 ` Andrew Morton
2007-05-01 14:06 ` Ben Pfaff
2007-05-01 19:08 ` Russell King [this message]
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=20070501190803.GB19872@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=pmiscml@gmail.com \
/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
Powered by JetHome