Check if ns before and not after dereferencing it.
Indicated by cppcheck.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
return NULL;
ns = spi_alloc_slave(struct nds_spi_slave, bus, cs);
return NULL;
ns = spi_alloc_slave(struct nds_spi_slave, bus, cs);
+ if (!ns)
+ return NULL;
switch (bus) {
case SPI0_BUS:
switch (bus) {
case SPI0_BUS:
ns->to = SPI_TIMEOUT;
ns->max_transfer_length = MAX_TRANSFER_LEN;
ns->slave.max_write_size = MAX_TRANSFER_LEN;
ns->to = SPI_TIMEOUT;
ns->max_transfer_length = MAX_TRANSFER_LEN;
ns->slave.max_write_size = MAX_TRANSFER_LEN;
- if (!ns)
- return NULL;