Re: [PATCH, RFC] HP WMI hotkey driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Matthew,

On Dec 26, 2007 5:48 PM, Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote:
> +       } else
> +               printk (KERN_INFO "HP WMI: Unknown response received\n");
> +
> +       return;

No need for empty returns.

> +}
> +
> +static int __init hp_wmi_init(void)
> +{
> +       int err;
> +       const struct key_entry *key;
> +
> +       if (!wmi_has_guid(HPWMI_GUID)) {
> +               printk ("Unable to locate guid\n");
> +               return -ENODEV;
> +       }
> +
> +       err = wmi_install_notify_handler (hp_wmi_notify, NULL);
> +       if (err)
> +               return err;
> +
> +       hp_wmi_input_dev = input_allocate_device();
> +
> +       hp_wmi_input_dev->name = "HP WMI hotkeys";
> +       hp_wmi_input_dev->phys = "wmi/input0";
> +       hp_wmi_input_dev->id.bustype = BUS_HOST;
> +       hp_wmi_input_dev->getkeycode = hp_wmi_getkeycode;
> +       hp_wmi_input_dev->setkeycode = hp_wmi_setkeycode;
> +

There is no sysfs device to attach the input device to, by any chance?

> +       for (key = hp_wmi_keymap; key->type != KE_END; key++) {
> +               set_bit(EV_KEY, hp_wmi_input_dev->evbit);
> +               set_bit(key->keycode, hp_wmi_input_dev->keybit);
> +       }
> +
> +       err = input_register_device (hp_wmi_input_dev);
> +
> +       if (err) {
> +               input_free_device (hp_wmi_input_dev);
> +               return err;
> +       }
> +
> +       return 0;
> +}
> +
> +static void __exit hp_wmi_exit(void)
> +{
> +       wmi_remove_notify_handler();
> +       input_unregister_device (hp_wmi_input_dev);
> +       input_free_device (hp_wmi_input_dev);

Do not call input_free_device after input_unregister_device, it may
cause freeing already freed memory.

-- 
Dmitry
-
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux