[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <470BAFD7.10305@tiscali.nl>
Date: Tue, 09 Oct 2007 18:44:07 +0200
From: Roel Kluin <12o3l@...cali.nl>
To: "Mark M. Hoffman" <mhoffman@...htlink.com>
CC: "Darrick J. Wong" <djwong@...ibm.com>,
Jean Delvare <khali@...ux-fr.org>,
Henrique de Moraes Holschuh <hmh@....eng.br>,
linux-kernel@...r.kernel.org, lm-sensors@...sensors.org,
haveblue@...ibm.com
Subject: Re: [PATCH v4] IBM power meter driver
Mark M. Hoffman wrote:
>> +static void ibmpex_register_bmc(int iface, struct device *dev)
>> +{
>> + struct ibmpex_bmc_data *data;
>> + int err;
>> +
>> + data = kzalloc(sizeof(*data), GFP_KERNEL);
>> + if (!data) {
>> + printk(KERN_ERR DRVNAME ": Insufficient memory for BMC "
>> + "interface %d.\n", data->interface);
>> + return;
>> + }
>> +
>> + data->address.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE;
>> + data->address.channel = IPMI_BMC_CHANNEL;
>> + data->address.data[0] = 0;
>> + data->interface = iface;
>> + data->bmc_device = dev;
>> +
>> + /* Create IPMI messaging interface user */
>> + err = ipmi_create_user(data->interface, &driver_data.ipmi_hndlrs,
>> + data, &data->user);
>> + if (err < 0) {
>> + printk(KERN_ERR DRVNAME ": Error, unable to register user with "
>> + "ipmi interface %d\n",
>> + data->interface);
>> + goto out;
>> + }
>> +
>> + mutex_init(&data->lock);
>> +
>> + /* Initialize message */
>> + data->tx_msgid = 0;
>> + init_completion(&data->read_complete);
>> + data->tx_message.netfn = PEX_NET_FUNCTION;
>> + data->tx_message.cmd = PEX_COMMAND;
>> + data->tx_message.data = data->tx_msg_data;
>> +
>> + /* Does this BMC support PowerExecutive? */
>> + err = ibmpex_ver_check(data);
>> + if (err)
>> + goto out_user;
>> +
>> + /* Register the BMC as a HWMON class device */
>> + data->hwmon_dev = hwmon_device_register(data->bmc_device);
>> +
>> + if (IS_ERR(data->hwmon_dev)) {
>> + printk(KERN_ERR DRVNAME ": Error, unable to register hwmon "
>> + "class device for interface %d\n",
>> + data->interface);
>> + kfree(data);
>> + return;
don't you want to goto out_user here instead?
>> + }
>> +
>> + /* finally add the new bmc data to the bmc data list */
>> + dev_set_drvdata(dev, data);
>> + list_add_tail(&data->list, &driver_data.bmc_data);
>> +
>> + /* Now go find all the sensors */
>> + err = ibmpex_find_sensors(data);
>> + if (err) {
>> + printk(KERN_ERR "Error %d allocating memory\n", err);
>> + goto out_register;
>> + }
>> +
>> + return;
>> +
>> +out_register:
>> + hwmon_device_unregister(data->hwmon_dev);
>> +out_user:
>> + ipmi_destroy_user(data->user);
>> +out:
>> + kfree(data);
>> +}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists