diff options
Diffstat (limited to 'drivers/rtc/rtc-fm3130.c')
| -rw-r--r-- | drivers/rtc/rtc-fm3130.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-fm3130.c b/drivers/rtc/rtc-fm3130.c index bff3cdc5140e..2835fb6c1965 100644 --- a/drivers/rtc/rtc-fm3130.c +++ b/drivers/rtc/rtc-fm3130.c | |||
| @@ -358,7 +358,7 @@ static int fm3130_probe(struct i2c_client *client, | |||
| 358 | I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) | 358 | I2C_FUNC_I2C | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) |
| 359 | return -EIO; | 359 | return -EIO; |
| 360 | 360 | ||
| 361 | fm3130 = kzalloc(sizeof(struct fm3130), GFP_KERNEL); | 361 | fm3130 = devm_kzalloc(&client->dev, sizeof(struct fm3130), GFP_KERNEL); |
| 362 | 362 | ||
| 363 | if (!fm3130) | 363 | if (!fm3130) |
| 364 | return -ENOMEM; | 364 | return -ENOMEM; |
| @@ -395,7 +395,7 @@ static int fm3130_probe(struct i2c_client *client, | |||
| 395 | 395 | ||
| 396 | tmp = i2c_transfer(adapter, fm3130->msg, 4); | 396 | tmp = i2c_transfer(adapter, fm3130->msg, 4); |
| 397 | if (tmp != 4) { | 397 | if (tmp != 4) { |
| 398 | pr_debug("read error %d\n", tmp); | 398 | dev_dbg(&client->dev, "read error %d\n", tmp); |
| 399 | err = -EIO; | 399 | err = -EIO; |
| 400 | goto exit_free; | 400 | goto exit_free; |
| 401 | } | 401 | } |
| @@ -507,7 +507,7 @@ bad_clock: | |||
| 507 | 507 | ||
| 508 | /* We won't bail out here because we just got invalid data. | 508 | /* We won't bail out here because we just got invalid data. |
| 509 | Time setting from u-boot doesn't work anyway */ | 509 | Time setting from u-boot doesn't work anyway */ |
| 510 | fm3130->rtc = rtc_device_register(client->name, &client->dev, | 510 | fm3130->rtc = devm_rtc_device_register(&client->dev, client->name, |
| 511 | &fm3130_rtc_ops, THIS_MODULE); | 511 | &fm3130_rtc_ops, THIS_MODULE); |
| 512 | if (IS_ERR(fm3130->rtc)) { | 512 | if (IS_ERR(fm3130->rtc)) { |
| 513 | err = PTR_ERR(fm3130->rtc); | 513 | err = PTR_ERR(fm3130->rtc); |
| @@ -517,16 +517,11 @@ bad_clock: | |||
| 517 | } | 517 | } |
| 518 | return 0; | 518 | return 0; |
| 519 | exit_free: | 519 | exit_free: |
| 520 | kfree(fm3130); | ||
| 521 | return err; | 520 | return err; |
| 522 | } | 521 | } |
| 523 | 522 | ||
| 524 | static int fm3130_remove(struct i2c_client *client) | 523 | static int fm3130_remove(struct i2c_client *client) |
| 525 | { | 524 | { |
| 526 | struct fm3130 *fm3130 = i2c_get_clientdata(client); | ||
| 527 | |||
| 528 | rtc_device_unregister(fm3130->rtc); | ||
| 529 | kfree(fm3130); | ||
| 530 | return 0; | 525 | return 0; |
| 531 | } | 526 | } |
| 532 | 527 | ||
