summaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorUwe Kleine-König <(address hidden)>2022-09-26 12:40:11 +0200
committerArnd Bergmann <arnd@arndb.de>2022-09-26 12:40:11 +0200
commita4d1846512e12f9e84be63b3f2f2165e4d0d2d1e (patch)
tree4e6331f9d50d745a1d3567bed92aa084d7bfc076 /drivers/soc
parent63872304bdb3decd5454f4dd210c25395278ed13 (diff)
downloadlinux-a4d1846512e12f9e84be63b3f2f2165e4d0d2d1e.tar.gz
linux-a4d1846512e12f9e84be63b3f2f2165e4d0d2d1e.tar.bz2
linux-a4d1846512e12f9e84be63b3f2f2165e4d0d2d1e.zip
pxa: Drop if with an always false condition
The remove callback is only called after probe completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so ssp is never NULL. Also note that returning an error code from a remove callback doesn't result in the device staying bound. It's still removed and devm callbacks are called. So the memory that ssp pointed to during probe, goes away without the node being removed from ssp_list. The probable result of an early exit is accessing freed memory when the list is walked the next time. Signed-off-by: Uwe Kleine-König <(address hidden)> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/pxa/ssp.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/soc/pxa/ssp.c b/drivers/soc/pxa/ssp.c
index 563440315acd..93449fb3519e 100644
--- a/drivers/soc/pxa/ssp.c
+++ b/drivers/soc/pxa/ssp.c
@@ -180,11 +180,7 @@ static int pxa_ssp_probe(struct platform_device *pdev)
static int pxa_ssp_remove(struct platform_device *pdev)
{
- struct ssp_device *ssp;
-
- ssp = platform_get_drvdata(pdev);
- if (ssp == NULL)
- return -ENODEV;
+ struct ssp_device *ssp = platform_get_drvdata(pdev);
mutex_lock(&ssp_lock);
list_del(&ssp->node);