]> git.hungrycats.org Git - linux/commit
i2c: i801: Avoid potential double call to gpiod_remove_lookup_table
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 4 Mar 2024 20:31:06 +0000 (21:31 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:41 +0000 (15:11 +0200)
commit63ba99702ee1c29414060baae5e9da78cb786cf5
tree8b23ae862d5a50656c97867c7ad2ea9e71bf13fe
parentdea99e1c61648c34d222c0e8fb1022d66b044a24
i2c: i801: Avoid potential double call to gpiod_remove_lookup_table

commit ceb013b2d9a2946035de5e1827624edc85ae9484 upstream.

If registering the platform device fails, the lookup table is
removed in the error path. On module removal we would try to
remove the lookup table again. Fix this by setting priv->lookup
only if registering the platform device was successful.
In addition free the memory allocated for the lookup table in
the error path.

Fixes: d308dfbf62ef ("i2c: mux/i801: Switch to use descriptor passing")
Cc: stable@vger.kernel.org
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-i801.c