On Mon, May 3, 2021 at 10:47 AM Sa, Nuno <Nuno.Sa@xxxxxxxxxx> wrote: > > From: Sa, Nuno <Nuno.Sa@xxxxxxxxxx> > > Sent: Monday, May 3, 2021 9:15 AM ... > > Anyways, maybe sticking with realloc, we could just use a more normal > > pattern like: > > > > tmp = devm_realloc(bounce_fuffer, ...); > > if (!tmp) > > error; > > > > bounce_buffer = tmp; > > > > I just read your reply to Andy about this and I think you are right... If the > new allocation fails, the older pointer is still preserved. However, I find > the above form a bit more readable and straight :) You beat me up to it. While devm_realloc() may actually be safer, the pattern is that: we should not rely on specifics of the custom implementation, it will really confuse new contributors or people who may take this as a "good' (which is not) pattern. -- With Best Regards, Andy Shevchenko