Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit caae070c authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Mark Brown
Browse files

spi: Dont call master->setup if not populated



Currently the master->setup() is called unconditionally.
The assumption is that every driver need to implement this
callback. This encourages drivers to populate empty functions
to prevent crashing.

This patch prevents the call of master->setup() if it is not
populated.

Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3d70f8c6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1156,7 +1156,7 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master);
int spi_setup(struct spi_device *spi)
{
	unsigned	bad_bits;
	int		status;
	int		status = 0;

	/* help drivers fail *cleanly* when they need options
	 * that aren't supported with their current master
@@ -1171,6 +1171,7 @@ int spi_setup(struct spi_device *spi)
	if (!spi->bits_per_word)
		spi->bits_per_word = 8;

	if (spi->master->setup)
		status = spi->master->setup(spi);

	dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s"