lkml.org 
[lkml]   [2011]   [Nov]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 1/5] regmap: return ERR_PTR instead of NULL in regmap_init
    On Mon, Nov 14, 2011 at 10:40:15AM +0100, Lars-Peter Clausen wrote:
    > The regmap_init documentation states that it will either return a pointer to a
    > valid regmap structure or a ERR_PTR in case of an error. Currently it returns a
    > NULL pointer in case no bus or no config was given. Since NULL is not a
    > ERR_PTR a caller might assume that it is a pointer to a valid regmap structure,
    > so return a ERR_PTR(-EINVAL) instead.
    >
    > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
    > ---
    > drivers/base/regmap/regmap.c | 2 +-
    > 1 files changed, 1 insertions(+), 1 deletions(-)
    >
    > diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
    > index b08df85..b84ebf9 100644
    > --- a/drivers/base/regmap/regmap.c
    > +++ b/drivers/base/regmap/regmap.c
    > @@ -139,7 +139,7 @@ struct regmap *regmap_init(struct device *dev,
    > int ret = -EINVAL;
    >
    > if (!bus || !config)
    > - return NULL;
    > + goto err;
    >
    > map = kzalloc(sizeof(*map), GFP_KERNEL);
    > if (map == NULL) {
    > --
    > 1.7.7.1
    >
    >

    Acked-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>


    \
     
     \ /
      Last update: 2011-11-14 16:47    [W:0.021 / U:90.436 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site