Thread (27 messages) flat view 27 messages, 6 authors, 2012-07-31
DORMANTno replies

Revision v1 of 12 in this series.

Revisions (12)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 current
  7. v2 [diff vs current]
  8. v2 [diff vs current]
  9. v2 [diff vs current]
  10. v2 [diff vs current]
  11. v2 [diff vs current]
  12. v2 [diff vs current]

[PATCH 3/6] mv643xx.c: Add basic device tree support.

From: florian@openwrt.org (Florian Fainelli)
Date: 2012-07-31 15:12:39

Hello Ian,

On Monday 30 July 2012 17:32:39 Ian Molton wrote:
On 30/07/12 17:19, Amar Nath wrote:
quoted
Hi Ian,

On Mon, Jul 30, 2012 at 8:45 PM, Ian Molton 
[off-list ref]wrote:
quoted
quoted
-       pd = pdev->dev.platform_data;
+       if (pdev->dev.of_node) {
+               struct device_node *np = NULL;
+
+               /* when all users of this driver use FDT, we can remove
this */
+               pd = kzalloc(sizeof(*pd), GFP_ATOMIC);
Do you really need an allocation in atomic context here? Is not GFP_KERNEL 
sufficient?

There was a second place like this where you used an atomic allocation that 
needs fixing.
quoted
quoted
+               if (!pd) {
+                       dev_dbg(&pdev->dev, "Could not allocate platform
data\n");
+                       return -ENOMEM;
+               }
+
+               of_property_read_u32(pdev->dev.of_node,
+                       "port_number", &pd->port_number);
+               of_property_read_u32(pdev->dev.of_node,
+                       "phy_addr", &pd->phy_addr);
+               np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
+               if (np) {
+                       pd->shared = of_find_device_by_node(np);
+               } else {
+                       kfree(pd);
+                       return -ENODEV;
+               }
+       } else {
+               pd = pdev->dev.platform_data;
+       }
+
        if (pd == NULL) {
                dev_err(&pdev->dev, "no mv643xx_eth_platform_data\n");
                return -ENODEV;
Can this check for pd be moved in the else part above as well, as for the
pd allocation with kzalloc,
we have already made a check for memory allocation failure?
Yes, Folded in for v2.

-Ian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help