[PATCH 1/3] rtc: driver for the DryIce block found in i.MX25 chips
Russell King - ARM Linux
linux at arm.linux.org.uk
Wed Jan 27 16:46:38 EST 2010
On Wed, Jan 27, 2010 at 02:30:49PM +0100, Lothar Waßmann wrote:
> Hi,
>
> Baruch Siach writes:
> > + imxdi->clk = clk_get(&pdev->dev, NULL);
> > + if (IS_ERR(imxdi->clk)) {
> > + rc = -ENODEV;
> >
> rc = PTR_ERR(imxdi->clk);
Grr.
Why do people find the general principle that "if you have an error
code, propagate it upwards" is soo difficult to deal with?
We seem to have stuff like the above constantly appearing, or the evil
"lets return -1 because we can't be bothered to find an appropriate
error value" sillyness.
Why is this?
A suggestion - try thinking like this: "If I find myself typing
'return -1', immediate stop typing and take the time to find a better
value. If I find myself typing IS_ERR() make sure I use PTR_ERR to
assign an error code."
Simples.
More information about the linux-arm-kernel
mailing list