--- initial
+++ final
@@ -1,77 +1,76 @@
 static int m41t80_probe(struct i2c_client *client, const struct i2c_device_id *id) {
   struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
   int rc = 0;
   struct rtc_device *rtc = NULL;
   struct rtc_time tm;
   struct m41t80_data *m41t80_data = NULL;
   if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_BYTE_DATA)) {
     dev_err(&adapter->dev, "doesn't support I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_I2C_BLOCK\n");
     return -ENODEV;
   }
   m41t80_data = devm_kzalloc(&client->dev, sizeof(*m41t80_data), GFP_KERNEL);
   if (!m41t80_data) return -ENOMEM;
   m41t80_data->features = id->driver_data;
   i2c_set_clientdata(client, m41t80_data);
   if (client->irq > 0) {
     rc = devm_request_threaded_irq(&client->dev, client->irq, NULL, m41t80_handle_irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "m41t80", client);
     if (rc) {
       dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n");
       client->irq = 0;
     } else {
       m41t80_rtc_ops.read_alarm = m41t80_read_alarm;
       m41t80_rtc_ops.set_alarm = m41t80_set_alarm;
       m41t80_rtc_ops.alarm_irq_enable = m41t80_alarm_irq_enable;
       /* Enable the wakealarm */
       device_init_wakeup(&client->dev, true);
     }
   }
   rtc = devm_rtc_device_register(&client->dev, client->name, &m41t80_rtc_ops, THIS_MODULE);
   if (IS_ERR(rtc)) return PTR_ERR(rtc);
   m41t80_data->rtc = rtc;
   /* Make sure HT (Halt Update) bit is cleared */
   rc = i2c_smbus_read_byte_data(client, M41T80_REG_ALARM_HOUR);
   if (rc >= 0 && rc & M41T80_ALHOUR_HT) {
     if (m41t80_data->features & M41T80_FEATURE_HT) {
       m41t80_get_datetime(client, &tm);
       dev_info(&client->dev, "HT bit was set!\n");
       dev_info(&client->dev, "Power Down at %04i-%02i-%02i %02i:%02i:%02i\n", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
     }
     rc = i2c_smbus_write_byte_data(client, M41T80_REG_ALARM_HOUR, rc & ~M41T80_ALHOUR_HT);
   }
   if (rc < 0) {
     dev_err(&client->dev, "Can't clear HT bit\n");
     return rc;
   }
   /* Make sure ST (stop) bit is cleared */
   rc = i2c_smbus_read_byte_data(client, M41T80_REG_SEC);
   if (rc >= 0 && rc & M41T80_SEC_ST) rc = i2c_smbus_write_byte_data(client, M41T80_REG_SEC, rc & ~M41T80_SEC_ST);
   if (rc < 0) {
     dev_err(&client->dev, "Can't clear ST bit\n");
     return rc;
   }
   /* Export sysfs entries */
   rc = sysfs_create_group(&(&client->dev)->kobj, &attr_group);
   if (rc) {
     dev_err(&client->dev, "Failed to create sysfs group: %d\n", rc);
     return rc;
   }
-  rc = devm_add_action(&client->dev, m41t80_remove_sysfs_group, &client->dev);
+  rc = devm_add_action_or_reset(&client->dev, m41t80_remove_sysfs_group, &client->dev);
   if (rc) {
-    m41t80_remove_sysfs_group(&client->dev);
     dev_err(&client->dev, "Failed to add sysfs cleanup action: %d\n", rc);
     return rc;
   }
 #ifdef CONFIG_RTC_DRV_M41T80_WDT
   if (m41t80_data->features & M41T80_FEATURE_HT) {
     save_client = client;
     rc = misc_register(&wdt_dev);
     if (rc) return rc;
     rc = register_reboot_notifier(&wdt_notifier);
     if (rc) {
       misc_deregister(&wdt_dev);
       return rc;
     }
   }
 #endif
   return 0;
 }<sep>@@
expression e1,e2,e3,rc;
@@

	rc =
-        devm_add_action
+        devm_add_action_or_reset
		(e1,e2,e3);
        if (rc) {
		...
-               m41t80_remove_sysfs_group(e3);
                ...
	}