History log of /linux-master/drivers/media/spi/cxd2880-spi.c
Revision Date Author Comments
# a0386bba 23-Jan-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

spi: make remove callback a void function

The value returned by an spi driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Jérôme Pouiller <jerome.pouiller@silabs.com>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Claudius Heine <ch@denx.de>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org> # For MMC
Acked-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Acked-by: Łukasz Stelmach <l.stelmach@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20220123175201.34839-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>


# 61b738e9 12-Oct-2021 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

media: cxd2880: Eliminate dead code

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 <broonie@kernel.org>, kernel@pengutronix.de, linux-media@vger.kernel.org, linux-spi@vger.kernel.org
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 11b982e9 20-Jul-2021 Colin Ian King <colin.king@canonical.com>

media: cxd2880-spi: Fix a null pointer dereference on error handling path

Currently the null pointer check on dvb_spi->vcc_supply is inverted and
this leads to only null values of the dvb_spi->vcc_supply being passed
to the call of regulator_disable causing null pointer dereferences.
Fix this by only calling regulator_disable if dvb_spi->vcc_supply is
not null.

Addresses-Coverity: ("Dereference after null check")

Fixes: dcb014582101 ("media: cxd2880-spi: Fix an error handling path")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# dcb01458 10-Jun-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

media: cxd2880-spi: Fix an error handling path

If an error occurs after a successful 'regulator_enable()' call,
'regulator_disable()' must be called.

Fix the error handling path of the probe accordingly.

Fixes: cb496cd472af ("media: cxd2880-spi: Add optional vcc regulator")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 321c0d38 21-May-2021 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

media: cxd2880-spi: Fix some error messages

Fix some erroneous function names in some error messages.
Remove some spurious or useless trailing and leading character in some
messages.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 18490a1a 09-Feb-2021 Julia Lawall <Julia.Lawall@inria.fr>

media: use getter/setter functions

Use getter and setter functions, for a variety of data types.

Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# c54dbfcd 22-Dec-2018 Colin Ian King <colin.king@canonical.com>

media: cxd2880-spi: fix two memory leaks of dvb_spi

There are two return paths that do not kfree dvb_spi. Fix the memory
leaks by returning via the exit label fail_adapter that will free
dvi_spi.

Detected by CoverityScan, CID#1475991 ("Resource Leak")

Fixes: cb496cd472af ("media: cxd2880-spi: Add optional vcc regulator")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>?
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# cb496cd4 08-Nov-2018 Neil Armstrong <narmstrong@baylibre.com>

media: cxd2880-spi: Add optional vcc regulator

This patchset adds an optional VCC regulator to the driver probe function
to make sure power is enabled to the module before starting attaching to
the device.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 458ffce1 08-Nov-2018 Neil Armstrong <narmstrong@baylibre.com>

media: cxd2880-spi: fix probe when dvb_attach fails

When dvb_attach fails, probe returns 0, and remove crashes afterwards.
This patch sets the return value to -ENODEV when attach fails.

Fixes: bd24fcddf6b8 ("media: cxd2880-spi: Add support for CXD2880 SPI interface")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 447f0081 26-Apr-2018 Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>

media: cxd2880-spi: Modified how to declare structure

This is the modification of structure declaration for spi_transfer.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 53dcd70e 13-Mar-2018 Arnd Bergmann <arnd@arndb.de>

media: cxd2880-spi: avoid out-of-bounds access warning

The -Warray-bounds warning in gcc-8 triggers for a newly added file:

drivers/media/spi/cxd2880-spi.c: In function 'cxd2880_write_reg':
drivers/media/spi/cxd2880-spi.c:111:3: error: 'memcpy' forming offset [133, 258] is out of the bounds [0, 132] of object 'send_data' with type 'u8[132]' {aka 'unsigned char[132]'} [-Werror=array-bounds]

The problem appears to be that we have two range checks in this function,
first comparing against BURST_WRITE_MAX (128) and then comparing against
a literal '255'. The logic checking the buffer size looks at the second
one and decides that this might be the actual maximum data length.

This is understandable behavior from the compiler, but the code is actually
safe. Since the first check is already shorter, we can remove the loop
and only leave that. To be on the safe side in case BURST_WRITE_MAX might
be increased, I'm leaving the check against U8_MAX.

Fixes: bd24fcddf6b8 ("media: cxd2880-spi: Add support for CXD2880 SPI interface")

Cc: Martin Sebor <msebor@gmail.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>


# 7cbc3013 07-Mar-2018 Mauro Carvalho Chehab <mchehab@kernel.org>

media: cxd2880: Fix location of DVB headers

Fix a trivial conflict, where the location of DVB headers
got moved.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>


# bd24fcdd 18-Jan-2018 Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>

media: cxd2880-spi: Add support for CXD2880 SPI interface

This is the SPI adapter part of the driver for the
Sony CXD2880 DVB-T2/T tuner + demodulator.

Signed-off-by: Yasunari Takiguchi <Yasunari.Takiguchi@sony.com>
Signed-off-by: Masayuki Yamamoto <Masayuki.Yamamoto@sony.com>
Signed-off-by: Hideki Nozawa <Hideki.Nozawa@sony.com>
Signed-off-by: Kota Yonezawa <Kota.Yonezawa@sony.com>
Signed-off-by: Toshihiko Matsumoto <Toshihiko.Matsumoto@sony.com>
Signed-off-by: Satoshi Watanabe <Satoshi.C.Watanabe@sony.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>