Skip to contentSkip to conversation

board: st: common: cmd_stboard update

PATCH In review Patrice Chotard 2 participants 7 messages Feb 11 – Feb 24

lore
Share & tools
lore
#0 lore raw

cover board: st: common: cmd_stboard update

Adds stm32mp21xx-dk board support for cmd_stboard Adds uclass_get_device_by_driver()'s return value check to fix Synchronous Abort.

---
Patrice Chotard (2):
board: st: common: Add support of stm32mp21xx-dk board
board: st: common: add uclass_get_device_by_driver()'s return value check

 board/st/common/cmd_stboard.c | 6 ++++++
 1 file changed, 6 insertions(+)

---
base-commit: 66891ffb14920e35abfafcae795cf4604de6682f
change-id: 20260211-upstream_update_cmd_stboard-40acad16a247

Best regards,

Signature · 1 line
Patrice Chotard <[email protected]>
#1 lore raw

PATCH 1/2 board: st: common: Add support of stm32mp21xx-dk board

Add board identifier for STM32MP21 discovery board = MB2059.

---
 board/st/common/cmd_stboard.c | 1 +
 1 file changed, 1 insertion(+)
board/st/common/cmd_stboard.c +1 -0
index b9d0abdba7d..d77046499a0 100644
@@ -51,6 +51,7 @@ static bool check_stboard(u16 board)
 		0x1605, /* stm32mp25xx-dk */
 		0x1635,
 		0x1936, /* stm32mp25xx-ev1 */
+		0x2059, /* stm32mp21xx-dk */
 	};
 
 	for (i = 0; i < ARRAY_SIZE(st_board_id); i++)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] board: st: common: Add support of stm32mp21xx-dk board

Hi,

Quoted 13 lines · Patrice Chotard

Add board identifier for STM32MP21 discovery board = MB2059.

---
  board/st/common/cmd_stboard.c | 1 +
  1 file changed, 1 insertion(+)
board/st/common/cmd_stboard.c +0 -0
index b9d0abdba7d..d77046499a0 100644

board/st/common/cmd_stboard.c static bool check_stboard(u16 board) · line 57

Quoted 7 lines
board/st/common/cmd_stboard.c +1 -0
@@ -51,6 +51,7 @@ static bool check_stboard(u16 board)
  		0x1605, /* stm32mp25xx-dk */
  		0x1635,
  		0x1936, /* stm32mp25xx-ev1 */
+		0x2059, /* stm32mp21xx-dk */
  	};
 
  	for (i = 0; i < ARRAY_SIZE(st_board_id); i++)

Thanks
Patrick

#3 lore raw

Re: [PATCH 1/2] board: st: common: Add support of stm32mp21xx-dk board

Quoted 26 lines · Patrick DELAUNAY

Hi,

Quoted 12 lines · Patrice Chotard

Add board identifier for STM32MP21 discovery board = MB2059.

---
  board/st/common/cmd_stboard.c | 1 +

  1 file changed, 1 insertion(+)
board/st/common/cmd_stboard.c +0 -0
index b9d0abdba7d..d77046499a0 100644
@@ -51,6 +51,7 @@ static bool check_stboard(u16 board)
Quoted 7 lines

          0x1605, /* stm32mp25xx-dk */ 0x1635,
          0x1936, /* stm32mp25xx-ev1 */
+        0x2059, /* stm32mp21xx-dk */
      };
        for (i = 0; i < ARRAY_SIZE(st_board_id); i++)

Quoted 3 lines

Thanks
Patrick

Applied to u-boot-stm32/master

Thanks
Patrice

#4 lore raw

PATCH 2/2 board: st: common: add uclass_get_device_by_driver()'s return value check

In reply to Patrice Chotard

class_get_device_by_driver()'s return value is not checked, in case of BSEC driver is not probed, dev is not set and used just after as parameter of misc_read() which leads to a Synchronous Abort.

Add uclass_get_device_by_driver()'s return value check to fix it.

---
 board/st/common/cmd_stboard.c | 5 +++++
 1 file changed, 5 insertions(+)
board/st/common/cmd_stboard.c +5 -0
index d77046499a0..58d9f205b92 100644
@@ -92,6 +92,11 @@ static int do_stboard(struct cmd_tbl *cmdtp, int flag, int argc,
 					  DM_DRIVER_GET(stm32mp_bsec),
 					  &dev);
 
+	if (ret) {
+		puts("Can't get BSEC device\n");
+		return CMD_RET_FAILURE;
+	}
+
 	ret = misc_read(dev, STM32_BSEC_OTP(BSEC_OTP_BOARD),
 			&otp, sizeof(otp));
 
Signature · 1 line
2.43.0
Reviewed-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] board: st: common: add uclass_get_device_by_driver()'s return value check

Hi,

Quoted 18 lines · Patrice Chotard

class_get_device_by_driver()'s return value is not checked, in case of BSEC driver is not probed, dev is not set and used just after as parameter of misc_read() which leads to a Synchronous Abort.

Add uclass_get_device_by_driver()'s return value check to fix it.

---
  board/st/common/cmd_stboard.c | 5 +++++
  1 file changed, 5 insertions(+)
board/st/common/cmd_stboard.c +0 -0
index d77046499a0..58d9f205b92 100644
@@ -92,6 +92,11 @@ static int do_stboard(struct cmd_tbl *cmdtp, int flag, int argc,
  					  DM_DRIVER_GET(stm32mp_bsec),

board/st/common/cmd_stboard.c static int do_stboard(struct cmd_tbl *cmdtp, int flag, int argc, · line 102

Quoted 10 lines
board/st/common/cmd_stboard.c +5 -0
  					  &dev);
 
+	if (ret) {
+		puts("Can't get BSEC device\n");
+		return CMD_RET_FAILURE;
+	}
+
  	ret = misc_read(dev, STM32_BSEC_OTP(BSEC_OTP_BOARD),
  			&otp, sizeof(otp));
 

Thanks
Patrick

#6 lore raw

Re: [PATCH 2/2] board: st: common: add uclass_get_device_by_driver()'s return value check

Quoted 33 lines · Patrick DELAUNAY

Hi,

Quoted 25 lines · Patrice Chotard

class_get_device_by_driver()'s return value is not checked, in case of BSEC driver is not probed, dev is not set and used just after as parameter of misc_read() which leads to a Synchronous Abort.

Add uclass_get_device_by_driver()'s return value check to fix it.

---
  board/st/common/cmd_stboard.c | 5 +++++

  1 file changed, 5 insertions(+)
board/st/common/cmd_stboard.c +4 -0
index d77046499a0..58d9f205b92 100644
@@ -92,6 +92,11 @@ static int do_stboard(struct cmd_tbl *cmdtp, int flag, int argc,
                         DM_DRIVER_GET(stm32mp_bsec),
                         &dev);
   +    if (ret) {
+        puts("Can't get BSEC device\n");
+        return CMD_RET_FAILURE;
+    }
+
       ret = misc_read(dev, STM32_BSEC_OTP(BSEC_OTP_BOARD),
               &otp, sizeof(otp));
Quoted 1 line

Quoted 3 lines

Thanks
Patrick

Applied to u-boot-stm32/master

Thanks
Patrice