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

Commit 73ee39a4 authored by Christophe Leroy's avatar Christophe Leroy Committed by Mark Brown
Browse files

spi: fsl-spi: fix devm_ioremap_resource() error case



devm_ioremap_resource() doesn't return NULL but an ERR_PTR on error.

Reported-by: default avatarJonas Gorsky <jogo@openwrt.org>
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 575bec53
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -310,10 +310,15 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)


	if (mspi->flags & SPI_CPM1) {
	if (mspi->flags & SPI_CPM1) {
		struct resource *res;
		struct resource *res;
		void *pram;


		res = platform_get_resource(to_platform_device(dev),
		res = platform_get_resource(to_platform_device(dev),
					    IORESOURCE_MEM, 1);
					    IORESOURCE_MEM, 1);
		mspi->pram = devm_ioremap_resource(dev, res);
		pram = devm_ioremap_resource(dev, res);
		if (IS_ERR(pram))
			mspi->pram = NULL;
		else
			mspi->pram = pram;
	} else {
	} else {
		unsigned long pram_ofs = fsl_spi_cpm_get_pram(mspi);
		unsigned long pram_ofs = fsl_spi_cpm_get_pram(mspi);