From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:35686 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335AbcKQIRk (ORCPT ); Thu, 17 Nov 2016 03:17:40 -0500 Subject: Patch "Input: synaptics-rmi4 - fix error handling in SPI transport driver" has been added to the 4.8-stable tree To: linux@roeck-us.net, dmitry.torokhov@gmail.com, gregkh@linuxfoundation.org Cc: , From: Date: Thu, 17 Nov 2016 09:17:44 +0100 Message-ID: <14793706642299@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled Input: synaptics-rmi4 - fix error handling in SPI transport driver to the 4.8-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: input-synaptics-rmi4-fix-error-handling-in-spi-transport-driver.patch and it can be found in the queue-4.8 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From bbc2ceeb3220e54c7574f0b5e3a252fd9a62cf8a Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Tue, 4 Oct 2016 11:48:55 -0700 Subject: Input: synaptics-rmi4 - fix error handling in SPI transport driver From: Guenter Roeck commit bbc2ceeb3220e54c7574f0b5e3a252fd9a62cf8a upstream. Instantiating the rmi4 SPI transport driver without an interrupt assigned caused the driver to fail to load, but it does not clean up its transport device registration. Result may be a crash at a later time, for example when rebooting the system. Fixes: 8d99758dee31 ("Input: synaptics-rmi4 - add SPI transport driver") Signed-off-by: Guenter Roeck Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/rmi4/rmi_spi.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) --- a/drivers/input/rmi4/rmi_spi.c +++ b/drivers/input/rmi4/rmi_spi.c @@ -396,6 +396,13 @@ static inline int rmi_spi_of_probe(struc } #endif +static void rmi_spi_unregister_transport(void *data) +{ + struct rmi_spi_xport *rmi_spi = data; + + rmi_unregister_transport_device(&rmi_spi->xport); +} + static int rmi_spi_probe(struct spi_device *spi) { struct rmi_spi_xport *rmi_spi; @@ -464,6 +471,11 @@ static int rmi_spi_probe(struct spi_devi dev_err(&spi->dev, "failed to register transport.\n"); return retval; } + retval = devm_add_action_or_reset(&spi->dev, + rmi_spi_unregister_transport, + rmi_spi); + if (retval) + return retval; retval = rmi_spi_init_irq(spi); if (retval < 0) @@ -473,15 +485,6 @@ static int rmi_spi_probe(struct spi_devi return 0; } -static int rmi_spi_remove(struct spi_device *spi) -{ - struct rmi_spi_xport *rmi_spi = spi_get_drvdata(spi); - - rmi_unregister_transport_device(&rmi_spi->xport); - - return 0; -} - #ifdef CONFIG_PM_SLEEP static int rmi_spi_suspend(struct device *dev) { @@ -577,7 +580,6 @@ static struct spi_driver rmi_spi_driver }, .id_table = rmi_id, .probe = rmi_spi_probe, - .remove = rmi_spi_remove, }; module_spi_driver(rmi_spi_driver); Patches currently in stable-queue which might be from linux@roeck-us.net are queue-4.8/input-synaptics-rmi4-fix-error-handling-in-spi-transport-driver.patch queue-4.8/watchdog-core-fix-devres_alloc-allocation-size.patch queue-4.8/input-synaptics-rmi4-fix-error-handling-in-i2c-transport-driver.patch