mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	rtc: isl1208: switch to rtc_register_device
Fix possible race condition. It is not allowed to return with an error code after RTC is registered. Suggested-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com> Reviewed-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
		
							parent
							
								
									9d327c2d92
								
							
						
					
					
						commit
						236b718703
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
					@ -635,12 +635,12 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 | 
				
			||||||
	if (isl1208_i2c_validate_client(client) < 0)
 | 
						if (isl1208_i2c_validate_client(client) < 0)
 | 
				
			||||||
		return -ENODEV;
 | 
							return -ENODEV;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name,
 | 
						rtc = devm_rtc_allocate_device(&client->dev);
 | 
				
			||||||
				  &isl1208_rtc_ops,
 | 
					 | 
				
			||||||
				  THIS_MODULE);
 | 
					 | 
				
			||||||
	if (IS_ERR(rtc))
 | 
						if (IS_ERR(rtc))
 | 
				
			||||||
		return PTR_ERR(rtc);
 | 
							return PTR_ERR(rtc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						rtc->ops = &isl1208_rtc_ops;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	i2c_set_clientdata(client, rtc);
 | 
						i2c_set_clientdata(client, rtc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc = isl1208_i2c_get_sr(client);
 | 
						rc = isl1208_i2c_get_sr(client);
 | 
				
			||||||
| 
						 | 
					@ -674,7 +674,7 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return rtc_register_device(rtc);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue