mirror of
				https://review.coreboot.org/flashrom.git
				synced 2025-10-31 05:10:41 +01:00 
			
		
		
		
	programmer: Make use of new register_opaque_master() API
Pass pointers to dynamically allocated data to register_opaque_master(). This way we can avoid a mutable global. BUG=b:185191942 TEST=builds Change-Id: I160810cd67f782131962e96fc6d20e2987fb0390 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54171 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
		 Anastasia Klimchuk
					Anastasia Klimchuk
				
			
				
					committed by
					
						 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
			
				
	
			
			
			 Edward O'Callaghan
						Edward O'Callaghan
					
				
			
						parent
						
							9309bed290
						
					
				
				
					commit
					9a2f91d7eb
				
			| @@ -295,7 +295,7 @@ static int linux_mtd_erase(struct flashctx *flash, | ||||
| 	return 0; | ||||
| } | ||||
|  | ||||
| static struct opaque_master programmer_linux_mtd = { | ||||
| static const struct opaque_master programmer_linux_mtd = { | ||||
| 	/* max_data_{read,write} don't have any effect for this programmer */ | ||||
| 	.max_data_read	= MAX_DATA_UNSPECIFIED, | ||||
| 	.max_data_write	= MAX_DATA_UNSPECIFIED, | ||||
| @@ -418,13 +418,12 @@ int linux_mtd_init(void) | ||||
| 		goto linux_mtd_init_exit; | ||||
| 	} | ||||
|  | ||||
| 	programmer_linux_mtd.data = data; | ||||
| 	if (register_shutdown(linux_mtd_shutdown, (void *)data)) { | ||||
| 		free(data); | ||||
| 		goto linux_mtd_init_exit; | ||||
| 	} | ||||
|  | ||||
| 	register_opaque_master(&programmer_linux_mtd, NULL); | ||||
| 	register_opaque_master(&programmer_linux_mtd, data); | ||||
|  | ||||
| 	ret = 0; | ||||
| linux_mtd_init_exit: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user