From: Michael Buesch <mb@bu3sch.de>
To: Olof Johansson <olof@lixom.net>
Cc: linuxppc-dev@ozlabs.org, egor@pasemi.com
Subject: Re: [PATCH] [2.6.22] pasemi: hardware rng driver
Date: Thu, 26 Apr 2007 11:22:03 +0200 [thread overview]
Message-ID: <200704261122.03452.mb@bu3sch.de> (raw)
In-Reply-To: <20070425204512.GB19781@lixom.net>
On Wednesday 25 April 2007 22:45:12 Olof Johansson wrote:
> +static int __devinit rng_probe(struct of_device *ofdev,
> + const struct of_device_id *match)
> +{
> + struct device_node *rng_np;
> + struct resource res;
> + int err = 0;
> +
> + rng_np = of_find_compatible_node(NULL, "rng", "1682m-rng");
> + if (!rng_np)
> + return -ENODEV;
> +
> + err = of_address_to_resource(rng_np, 0, &res);
> + of_node_put(rng_np);
> +
> + if (err)
> + return -EINVAL;
I think EINVAL is not the correct error code. I'd suggest ENODEV.
> + if (!rng_regs)
> + rng_regs = ioremap(res.start, 0x100);
> +
> + if (!rng_regs)
> + return -EPERM;
I think EPERM is not the correct error code. I'd suggest ENOMEM.
> + printk(KERN_INFO "Registering PA Semi RNG\n");
> +
> + return hwrng_register(&pasemi_rng);
Resource leak.
Please do something like
err = hwrng_register(&pasemi_rng);
if (err)
iounmap(rng_regs);
return err;
> +}
> +
> +static int rng_remove(struct of_device *dev)
> +{
> + iounmap(rng_regs);
> + hwrng_unregister(&pasemi_rng);
Swap these to prevent race conditions.
> +
> + return 0;
> +}
--
Greetings Michael.
next prev parent reply other threads:[~2007-04-26 9:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-25 20:45 [PATCH] [2.6.22] pasemi: hardware rng driver Olof Johansson
2007-04-25 23:38 ` Arnd Bergmann
2007-04-26 0:09 ` Olof Johansson
2007-04-26 9:23 ` Michael Buesch
2007-04-26 5:37 ` [PATCH v2] " Olof Johansson
2007-04-26 8:50 ` Arnd Bergmann
2007-04-26 20:59 ` [PATCH v3] " Olof Johansson
2007-04-26 9:22 ` Michael Buesch [this message]
2007-04-26 20:46 ` [PATCH] " Olof Johansson
-- strict thread matches above, loose matches on Subject: below --
2007-04-27 10:54 [PATCH 2.6.22] " Michael Buesch
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=200704261122.03452.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=egor@pasemi.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=olof@lixom.net \
/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).