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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]