1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
19647: drivers/mtd_spi_nor: fix hang and debug msgs r=aabadie a=Enoch247

### Contribution description

This patch adds a missing release of the SPI bus on error

### Testing procedure

This was discovered while attempting to bring up a board where I had the pin definitions wrong for a SPI flash part. Once the driver was fixed I was able to get the debug messages and not hang other drivers using the same bus.

### Issues/PRs references

None known

Co-authored-by: Joshua DeWeese <jdeweese@primecontrols.com>
This commit is contained in:
bors[bot] 2023-05-22 20:02:16 +00:00 committed by GitHub
commit e4490f1793
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -458,6 +458,7 @@ static int mtd_spi_nor_power(mtd_dev_t *mtd, enum mtd_power_state power)
retries++;
} while (res < 0 && retries < MTD_POWER_UP_WAIT_FOR_ID);
if (res < 0) {
mtd_spi_release(dev);
return -EIO;
}
/* enable 32 bit address mode */
@ -501,9 +502,9 @@ static int mtd_spi_nor_init(mtd_dev_t *mtd)
_init_pins(dev);
/* power up the MTD device*/
DEBUG("mtd_spi_nor_init: power up MTD device");
DEBUG_PUTS("mtd_spi_nor_init: power up MTD device");
if (mtd_spi_nor_power(mtd, MTD_POWER_UP)) {
DEBUG("mtd_spi_nor_init: failed to power up MTD device");
DEBUG_PUTS("mtd_spi_nor_init: failed to power up MTD device");
return -EIO;
}