From: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
To: santosh.shilimkar-l0cyMroinI0@public.gmane.org
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
sandeep_n-l0cyMroinI0@public.gmane.org,
jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH v3 2/3] net: Add Keystone NetCP ethernet driver
Date: Mon, 15 Sep 2014 12:37:55 -0400 (EDT) [thread overview]
Message-ID: <20140915.123755.1868053059646672094.davem@davemloft.net> (raw)
In-Reply-To: <1410638839-14792-3-git-send-email-santosh.shilimkar-l0cyMroinI0@public.gmane.org>
From: Santosh Shilimkar <santosh.shilimkar-l0cyMroinI0@public.gmane.org>
Date: Sat, 13 Sep 2014 16:07:18 -0400
> + /* Find this module in the sub-tree for this device */
> + devices = of_get_child_by_name(node, "netcp-devices");
> + if (!devices) {
> + dev_err(dev, "could not find netcp-devices node\n");
> + return NETCP_MOD_PROBE_SKIPPED;
> + }
> +
> + for_each_available_child_of_node(devices, child) {
> + const char *name = netcp_node_name(child);
> +
> + if (!strcasecmp(module->name, name))
> + break;
> + }
> +
> + /* If module not used for this device, skip it */
> + if (child == NULL) {
> + dev_warn(dev, "module(%s) not used for device\n", module->name);
> + return NETCP_MOD_PROBE_SKIPPED;
> + }
of_get_child_by_name() takes a reference to an OF node, you must release
it in the error path.
> + inst_modpriv = devm_kzalloc(dev, sizeof(*inst_modpriv), GFP_KERNEL);
> + if (!inst_modpriv) {
> + dev_err(dev, "Failed to allocate instance for %s\n",
> + module->name);
> + return -ENOMEM;
> + }
Likewise, but here you have to release both "devices" and "child".
You're going to have to fix this OF node refcount problem for this
entire probe routine.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-09-15 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-13 20:07 [PATCH v3 0/3] net: Add Keystone NetCP ethernet driver support Santosh Shilimkar
2014-09-13 20:07 ` [PATCH v3 1/3] Documentation: dt: net: Add binding doc for Keystone NetCP ethernet driver Santosh Shilimkar
2014-09-13 20:07 ` [PATCH v3 2/3] net: Add " Santosh Shilimkar
[not found] ` <1410638839-14792-3-git-send-email-santosh.shilimkar-l0cyMroinI0@public.gmane.org>
2014-09-15 16:37 ` David Miller [this message]
2014-09-16 13:44 ` Sandeep Nair
[not found] ` <54183EDB.20801-l0cyMroinI0@public.gmane.org>
2014-09-24 19:51 ` Santosh Shilimkar
[not found] ` <542320B3.9020902-l0cyMroinI0@public.gmane.org>
2014-09-24 20:43 ` David Miller
2014-09-25 13:43 ` Santosh Shilimkar
2014-09-13 20:07 ` [PATCH v3 3/3] MAINTAINER: net: Add TI NETCP Ethernet driver entry Santosh Shilimkar
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=20140915.123755.1868053059646672094.davem@davemloft.net \
--to=davem-ft/pcqaiutieiz0/mpfg9q@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sandeep_n-l0cyMroinI0@public.gmane.org \
--cc=santosh.shilimkar-l0cyMroinI0@public.gmane.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;
as well as URLs for NNTP newsgroup(s).