File tree Expand file tree Collapse file tree 1 file changed +17
-10
lines changed
Expand file tree Collapse file tree 1 file changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -167,7 +167,8 @@ struct rt_device *fal_blk_device_create(const char *parition_name)
167167 return NULL ;
168168 }
169169
170- if ((fal_flash = fal_flash_device_find (fal_part -> flash_name )) == NULL )
170+ fal_flash = fal_flash_device_find (fal_part -> flash_name );
171+ if (fal_flash == NULL )
171172 {
172173 LOG_E ("Error: the flash device name (%s) is not found." , fal_part -> flash_name );
173174 return NULL ;
@@ -309,7 +310,8 @@ struct rt_device *fal_mtd_nor_device_create(const char *parition_name)
309310 return NULL ;
310311 }
311312
312- if ((fal_flash = fal_flash_device_find (fal_part -> flash_name )) == NULL )
313+ fal_flash = fal_flash_device_find (fal_part -> flash_name );
314+ if (fal_flash == NULL )
313315 {
314316 LOG_E ("Error: the flash device name (%s) is not found." , fal_part -> flash_name );
315317 return NULL ;
@@ -620,19 +622,24 @@ static void fal(rt_uint8_t argc, char **argv) {
620622 if (argc >= 3 )
621623 {
622624 char * dev_name = argv [2 ];
623- if ((flash_dev = fal_flash_device_find (dev_name )) != NULL )
625+ flash_dev = fal_flash_device_find (dev_name );
626+ if (flash_dev != NULL )
624627 {
625628 part_dev = NULL ;
626629 }
627- else if ((part_dev = fal_partition_find (dev_name )) != NULL )
628- {
629- flash_dev = NULL ;
630- }
631630 else
632631 {
633- rt_kprintf ("Device %s NOT found. Probe failed.\n" , dev_name );
634- flash_dev = NULL ;
635- part_dev = NULL ;
632+ part_dev = fal_partition_find (dev_name );
633+ if (part_dev != NULL )
634+ {
635+ flash_dev = NULL ;
636+ }
637+ else
638+ {
639+ rt_kprintf ("Device %s NOT found. Probe failed.\n" , dev_name );
640+ flash_dev = NULL ;
641+ part_dev = NULL ;
642+ }
636643 }
637644 }
638645
You can’t perform that action at this time.
0 commit comments