Re: [PATCH v2] add MAX17040 Fuel Gauge driver

From: Andrew Morton
Date: Thu Jun 04 2009 - 05:07:15 EST


On Thu, 04 Jun 2009 17:55:36 +0900 Minkyu Kang <mk7.kang@xxxxxxxxxxx> wrote:

> + INIT_DELAYED_WORK_DEFERRABLE(&chip->work, max17040_work);
> + schedule_delayed_work(&chip->work, MAX17040_DELAY);
> +
> + bat_ps.properties = max17040_battery_props;
> + bat_ps.num_properties = ARRAY_SIZE(max17040_battery_props);
> +
> + ret = power_supply_register(&client->dev, &bat_ps);
> + if (ret) {
> + dev_err(&max17040->client->dev,
> + "failed: power supply register\n");
> + cancel_delayed_work(&chip->work);
> + i2c_set_clientdata(client, NULL);
> + kfree(chip);
> + max17040 = NULL;
> + return -1;
> + }
> +
> + return 0;
> +}

Wouldn't it be better to start the delayed_work after the
power_supply_register() has succeeded?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/