Re: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()

From: Linus Walleij
Date: Mon Feb 11 2013 - 08:53:53 EST

On Sat, Feb 9, 2013 at 2:52 PM, Grant Likely <grant.likely@xxxxxxxxxxxx> wrote:
> On Mon, 21 Jan 2013 16:22:21 +0530, Viresh Kumar <viresh.kumar@xxxxxxxxxx> wrote:

>> > - spics->base = devm_request_and_ioremap(&pdev->dev, res);
>> > - if (!spics->base) {
>> > - dev_err(&pdev->dev, "request and ioremap fail\n");
>> can we keep it as is?
> And this is why I dislike the ERR_PTR pattern so much. It goes against
> every instinct about what is and is not a valid pointer.
> I know people want error codes, but I think hoping that all users will
> remember to do 'if (IS_ERR(ptr))' instead of 'if (!ptr)' makes things
> worse not better.

NB: among the error codes people want to propagate from
consumer interfaces such as say, clk_get(), regulator_get()
and pinctrl_get() is -EPROBE_DEFER. So just "something
failed" (return NULL) isn't enough.

We then obviously need to return an int as error code instead
and pass the pointer as argument, so do you mean we should
refactor all the *_get() things from e.g.:

struct clk *clk_get(struct device *dev, const char *id);

into something like:

int clk_get(struct clk **clk, struct device *dev, const char *id);

across the entire kernel?

Linus Walleij
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at