[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111024201907.GD24914@google.com>
Date: Mon, 24 Oct 2011 13:19:07 -0700
From: Tejun Heo <tj@...nel.org>
To: unlisted-recipients:; (no To-header on input)
Cc: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Greg KH <gregkh@...e.de>,
Grant Likely <grant.likely@...retlab.ca>
Subject: Re: [RFC 3/4] lib: devres: add convenience function to remap a
resource
On Mon, Oct 24, 2011 at 10:09:33PM +0200, Wolfram Sang wrote:
> > So, for library functions, it's nice if the function doesn't hold any
> > extra resource on error return. devres has grouping to support this.
> > You just need to wrap allocations inside a group and remove it on
> > success and release on error. ie.
> >
> > if (!devres_open_group(dev, NULL, GFP_KERNEL))
> > return NULL;
> > if (alloc_resource(0) < 0)
> > goto fail;
> > if (alloc_resource(1) < 0)
> > goto fail;
> > devres_remove_group(dev, NULL);
> > return 0;
> > fail:
> > devres_release_group(dev, NULL);
> > return 0;
>
> I am not sure I got what you mean here, but wouldn't it be easier to simply
> call devm_release_mem_region() when devm_ioremap comes back with a NULL
> pointer?
Oh, yeah, that would work too. :)
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists