Re: [PATCH] gpio: swnode: Don't use __free() on result of swnode_get_gpio_device()

From: Charles Keepax
Date: Mon Mar 04 2024 - 12:34:45 EST


On Mon, Mar 04, 2024 at 05:34:27PM +0100, Bartosz Golaszewski wrote:
> On Mon, Mar 4, 2024 at 5:03 PM Charles Keepax
> <ckeepax@xxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > swnode_get_gpio_device() can return an error pointer, however
> > gpio_device_put() is not able to accept error values. Thus using
> > __free() will result in dereferencing an invalid pointer.
> >
>
> Can you post the steps to reproduce this? Because it should work[1].

Hmm... yeah that does look like it should work, I have had the
patch sitting in my tree for a little while, let me double check
and I will come back/resend if it is actually still needed.

Thanks,
Charles