phy: Fix possible NULL pointer deference
[oweals/u-boot.git] / drivers / gpio / pic32_gpio.c
index 7a037f3a77cd1009d2ca495d4cc7d9a8530721e1..bb1ad256fac0d6ebf9e01497c4d17a43f68f6e38 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2015 Microchip Technology Inc
  * Purna Chandra Mandal <purna.mandal@microchip.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -11,6 +10,7 @@
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <mach/pic32.h>
 
@@ -133,7 +133,8 @@ static int pic32_gpio_probe(struct udevice *dev)
        char *end;
        int bank;
 
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;