Browse Source

Merge tag 'u-boot-at91-fixes-2023.10-b' of https://source.denx.de/u-boot/custodians/u-boot-at91

Second set of u-boot-atmel fixes for the 2023.10 cycle:

Two small fixes , one for an array not initialized and the second one
fixes an error case when a DT property is missing for the atmel NAND
driver.
Tom Rini 8 months ago
parent
commit
2173c4a990

+ 2 - 2
drivers/clk/at91/sam9x60.c

@@ -429,8 +429,8 @@ static int sam9x60_clk_probe(struct udevice *dev)
 	if (!base)
 		return -EINVAL;
 
-	memset(muxallocs,    0, ARRAY_SIZE(muxallocs));
-	memset(clkmuxallocs, 0, ARRAY_SIZE(clkmuxallocs));
+	memset(muxallocs,    0, sizeof(muxallocs));
+	memset(clkmuxallocs, 0, sizeof(clkmuxallocs));
 
 	ret = clk_get_by_index(dev, 0, &clk);
 	if (ret)

+ 2 - 2
drivers/clk/at91/sama7g5.c

@@ -1115,8 +1115,8 @@ static int sama7g5_clk_probe(struct udevice *dev)
 	if (IS_ERR(base))
 		return PTR_ERR(base);
 
-	memset(muxallocs,    0, ARRAY_SIZE(muxallocs));
-	memset(clkmuxallocs, 0, ARRAY_SIZE(clkmuxallocs));
+	memset(muxallocs,    0, sizeof(muxallocs));
+	memset(clkmuxallocs, 0, sizeof(clkmuxallocs));
 
 	ret = clk_get_by_index(dev, 0, &clk);
 	if (ret)

+ 7 - 4
drivers/mtd/nand/raw/atmel/nand-controller.c

@@ -1601,10 +1601,13 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc,
 			nand->cs[i].rb.type = ATMEL_NAND_NATIVE_RB;
 			nand->cs[i].rb.id = val;
 		} else {
-			gpio_request_by_name_nodev(np, "rb-gpios", 0,
-						   &nand->cs[i].rb.gpio,
-						   GPIOD_IS_IN);
-			nand->cs[i].rb.type = ATMEL_NAND_GPIO_RB;
+			ret = gpio_request_by_name_nodev(np, "rb-gpios", 0,
+							 &nand->cs[i].rb.gpio,
+							 GPIOD_IS_IN);
+			if (ret && ret != -ENOENT)
+				dev_err(nc->dev, "Failed to get R/B gpio (err = %d)\n", ret);
+			if (!ret)
+				nand->cs[i].rb.type = ATMEL_NAND_GPIO_RB;
 		}
 
 		gpio_request_by_name_nodev(np, "cs-gpios", 0,