From: walter harms <wharms@bfs.de>
To: Vasiliy Kulikov <segooon@gmail.com>
Cc: kernel-janitors@vger.kernel.org,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 03/14] mca: fix device_register() error handling
Date: Sun, 19 Sep 2010 16:53:48 +0000 [thread overview]
Message-ID: <4C96401C.1000707@bfs.de> (raw)
In-Reply-To: <1284900887-24327-1-git-send-email-segooon@gmail.com>
Vasiliy Kulikov schrieb:
> If device_register() fails then call put_device().
> See comment to device_register.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
> I cannot compile this driver, so it is not tested at all.
>
> drivers/mca/mca-bus.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mca/mca-bus.c b/drivers/mca/mca-bus.c
> index ada5ebb..7162f08 100644
> --- a/drivers/mca/mca-bus.c
> +++ b/drivers/mca/mca-bus.c
> @@ -116,8 +116,10 @@ int __init mca_register_device(int bus, struct mca_device *mca_dev)
> mca_dev->dev.coherent_dma_mask = mca_dev->dma_mask;
>
> rc = device_register(&mca_dev->dev);
> - if (rc)
> + if (rc) {
> + put_device(&mca_dev->dev);
> goto err_out;
> + }
>
> rc = device_create_file(&mca_dev->dev, &dev_attr_id);
> if (rc) goto err_out_devreg;
> @@ -154,6 +156,7 @@ struct mca_bus * __devinit mca_attach_bus(int bus)
> dev_set_name(&mca_bus->dev, "mca%d", bus);
> sprintf(mca_bus->name,"Host %s MCA Bridge", bus ? "Secondary" : "Primary");
> if (device_register(&mca_bus->dev)) {
> + put_device(&mca_bus->dev);
> kfree(mca_bus);
> return NULL;
> }
just a minor: dev_set_name() is not check here. (But is in other places).
re,
wh
prev parent reply other threads:[~2010-09-19 16:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-19 12:54 [PATCH 03/14] mca: fix device_register() error handling Vasiliy Kulikov
2010-09-19 16:53 ` walter harms [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=4C96401C.1000707@bfs.de \
--to=wharms@bfs.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=segooon@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