From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Danny Huang <dahuang@nvidia.com>
Cc: swarren@wwwdotorg.org, ldewangan@nvidia.com, olof@lixom.net,
hdoyu@nvidia.com, thierry.reding@avionic-design.de,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3] ARM: tegra: expose chip ID and revision
Date: Wed, 13 Mar 2013 10:09:49 +0000 [thread overview]
Message-ID: <20130313100949.GA4977@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1363168080-12697-1-git-send-email-dahuang@nvidia.com>
On Wed, Mar 13, 2013 at 05:48:00PM +0800, Danny Huang wrote:
> + soc_dev = soc_device_register(soc_dev_attr);
> + if (IS_ERR(soc_dev)) {
> + kfree(soc_dev_attr->soc_id);
> + kfree(soc_dev_attr->revision);
> + kfree(soc_dev_attr->family);
> + kfree(soc_dev_attr);
> + goto out;
> + }
> +
> + parent = soc_device_to_device(soc_dev);
> + if (IS_ERR(parent))
> + parent = NULL;
I know other places have done this kind of thing but what use is it?
struct device *soc_device_to_device(struct soc_device *soc_dev)
{
return &soc_dev->dev;
}
Now, consider that soc_device_register() returns one of two things:
1. A valid pointer - it must be valid, because soc_device_register()
already dereferences it.
2. An error pointer, trappable with IS_ERR().
You are trapping it with IS_ERR() - that's good news. So, by the time
we get to soc_device_to_device(), we know that it _is_ a valid pointer.
So why would soc_device_to_device() return an error pointer?
next prev parent reply other threads:[~2013-03-13 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 9:48 [PATCH v3] ARM: tegra: expose chip ID and revision Danny Huang
2013-03-13 10:09 ` Russell King - ARM Linux [this message]
2013-03-13 17:45 ` Stephen Warren
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=20130313100949.GA4977@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=dahuang@nvidia.com \
--cc=hdoyu@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=olof@lixom.net \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@avionic-design.de \
/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;
as well as URLs for NNTP newsgroup(s).