From 61b738e938ef091e0c4c4e8eadeaf27502732e97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Tue, 12 Oct 2021 17:39:32 +0200 Subject: [PATCH] media: cxd2880: Eliminate dead code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An spi remove callback is never called with an spi_device pointer that is NULL. Also it is only called for devices that probed successfully. As cxd2880_spi_probe() always sets driver data, spi_get_drvdata() cannot be NULL. Also the return value of spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea. Link: https://lore.kernel.org/linux-media/20211012153945.2651412-8-u.kleine-koenig@pengutronix.de Cc: Mark Brown , kernel@pengutronix.de, linux-media@vger.kernel.org, linux-spi@vger.kernel.org Signed-off-by: Uwe Kleine-König Signed-off-by: Mauro Carvalho Chehab --- drivers/media/spi/cxd2880-spi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c index 506f52c1af10..6f2a66bc87fb 100644 --- a/drivers/media/spi/cxd2880-spi.c +++ b/drivers/media/spi/cxd2880-spi.c @@ -628,19 +628,8 @@ cxd2880_spi_probe(struct spi_device *spi) static int cxd2880_spi_remove(struct spi_device *spi) { - struct cxd2880_dvb_spi *dvb_spi; + struct cxd2880_dvb_spi *dvb_spi = spi_get_drvdata(spi); - if (!spi) { - pr_err("invalid arg\n"); - return -EINVAL; - } - - dvb_spi = spi_get_drvdata(spi); - - if (!dvb_spi) { - pr_err("failed\n"); - return -EINVAL; - } dvb_spi->demux.dmx.remove_frontend(&dvb_spi->demux.dmx, &dvb_spi->dmx_fe); dvb_dmxdev_release(&dvb_spi->dmxdev);