lkml.org 
[lkml]   [2013]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 08/33] gpio: Convert to devm_ioremap_resource()
    From
    On Sat, Feb 9, 2013 at 2:52 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
    > On Mon, 21 Jan 2013 16:22:21 +0530, Viresh Kumar <viresh.kumar@linaro.org> 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?

    Yours,
    Linus Walleij


    \
     
     \ /
      Last update: 2013-02-11 15:21    [W:2.749 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site