Thread (5 messages) flat view 5 messages, 2 authors, 2012-06-21

Re: [PATCH] SPI: at25: Parse dt settings

From: Alexandre Pereira da Silva <hidden>
Date: 2012-06-21 11:55:46
Also in: lkml

On Thu, Jun 21, 2012 at 8:10 AM, Alexandre Pereira da Silva
[off-list ref] wrote:
On Thu, Jun 21, 2012 at 6:49 AM, Ivo Sieben [off-list ref] wrote:
quoted
One small remark:
In case of platform_data, the "if (!chip)" check has been removed and
is now only handled in the device tree initialization.
Maybe add this check to the platform initialization as well:

} else {
       if (!spi->dev.platform_data) {
               dev_dbg(&spi->dev, "no chip description\n");
               err = -ENODEV;
               goto fail;
       }
       chip =  *(struct spi_eeprom *)spi->dev.platform_data;
}
Please ignore my last email. Not enough coffee.

I'm sorry. The code looks right to me.

-       chip = spi->dev.platform_data;
-       if (!chip) {
-               dev_dbg(&spi->dev, "no chip description\n");
-               err = -ENODEV;
-               goto fail;
-       }
+       if (!spi->dev.platform_data) {
+               if (np) {
                             /* No platform data and DT node present,
DT handling */
+               } else {
                            /* No DT and No platform description,
handle error */
+                       dev_dbg(&spi->dev, "no chip description\n");
+                       err = -ENODEV;
+                       goto fail;
+               }
+       } else
                 /* At this point chip is guaranteed to have valid data */
+               chip = *(struct spi_eeprom *)spi->dev.platform_data;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help