TI DaVinci: Driver for the davinci SPI controller
PATCH v4 1/1 TI DaVinci: Driver for the davinci SPI controller
From: Sekhar Nori <[email protected]>
This adds a driver for the SPI controller found on davinci based SoCs from Texas Instruments.
---
PATCH v4 1/1 TI DaVinci: Driver for the davinci SPI controller
Review
Quoted 1 line · On Wednesday 06 January 2010 06:18:21 Sudhakar Rajashekhara wrote:
(quoted diff) +1
-0+ ds = malloc(sizeof(struct davinci_spi_slave));
personally i find sizeof(*ds) to be better
Review
Quoted 9 lines
(quoted diff) +9
-0+void spi_free_slave(struct spi_slave *slave) +{ + struct davinci_spi_slave *ds = to_davinci_spi(slave); + + if (ds) { + free(ds); + ds = NULL; + } +}
free() already does a NULL pointer check, and assigning NULL to a stack variable is pointless. i.e. this function should simply be:
free(slave);
Review
Quoted 7 lines
(quoted diff) +6
-0+static inline struct davinci_spi_slave *to_davinci_spi(struct spi_slave *slave) +{ + if (!slave) + return NULL; + else + return container_of(slave, struct davinci_spi_slave, slave); +}
this logic is pointless ... container_of() on a NULL pointer is a NULL pointer, and it isnt like container_of() will deref the pointer causing a crash.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100106/57529085/attachment.pgp