mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	watchdog: jz4740: Fix return value check in jz4740_wdt_probe()
In case of error, the function device_node_to_regmap() returns
ERR_PTR() and never returns NULL. The NULL test in the return
value check should be replaced with IS_ERR().
Fixes: 6d532143c9 ("watchdog: jz4740: Use regmap provided by TCU driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20210304045909.945799-1-weiyongjun1@huawei.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
			
			
This commit is contained in:
		
							parent
							
								
									bc65baf73b
								
							
						
					
					
						commit
						29e85f53fb
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -176,9 +176,9 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
 | 
				
			||||||
	watchdog_set_drvdata(jz4740_wdt, drvdata);
 | 
						watchdog_set_drvdata(jz4740_wdt, drvdata);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	drvdata->map = device_node_to_regmap(dev->parent->of_node);
 | 
						drvdata->map = device_node_to_regmap(dev->parent->of_node);
 | 
				
			||||||
	if (!drvdata->map) {
 | 
						if (IS_ERR(drvdata->map)) {
 | 
				
			||||||
		dev_err(dev, "regmap not found\n");
 | 
							dev_err(dev, "regmap not found\n");
 | 
				
			||||||
		return -EINVAL;
 | 
							return PTR_ERR(drvdata->map);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return devm_watchdog_register_device(dev, &drvdata->wdt);
 | 
						return devm_watchdog_register_device(dev, &drvdata->wdt);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue