mirror of
				https://github.com/torvalds/linux.git
				synced 2025-10-31 16:48:26 +02:00 
			
		
		
		
	PM / devfreq: event: Call of_node_put() only once in devfreq_event_get_edev_by_phandle()
An of_node_put(node) call was immediately used after a null pointer check for the local variable “edev” at the end of this function implementation. Thus call such a function only once instead directly before the check. This issue was transformed by using the Coccinelle software. Link: https://lore.kernel.org/lkml/0f103384-376c-41f0-a35c-8ad98327d6cb@web.de/ Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
		
							parent
							
								
									40384c840e
								
							
						
					
					
						commit
						ed33fbb5d5
					
				
					 1 changed files with 2 additions and 6 deletions
				
			
		|  | @ -244,13 +244,9 @@ struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(struct device *dev, | ||||||
| 	edev = NULL; | 	edev = NULL; | ||||||
| out: | out: | ||||||
| 	mutex_unlock(&devfreq_event_list_lock); | 	mutex_unlock(&devfreq_event_list_lock); | ||||||
| 
 |  | ||||||
| 	if (!edev) { |  | ||||||
| 		of_node_put(node); |  | ||||||
| 		return ERR_PTR(-ENODEV); |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	of_node_put(node); | 	of_node_put(node); | ||||||
|  | 	if (!edev) | ||||||
|  | 		return ERR_PTR(-ENODEV); | ||||||
| 
 | 
 | ||||||
| 	return edev; | 	return edev; | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Markus Elfring
						Markus Elfring