Changeset f2964e45 in mainline


Ignore:
Timestamp:
2011-10-14T15:36:12Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
98604cc
Parents:
c5b6db53
Message:

usbhid: mouse drv unbinds DDF functions on destruction.

Location:
uspace/drv/bus/usb/usbhid/mouse
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.c

    rc5b6db53 rf2964e45  
    186186        if (mouse_dev->wheel_sess != NULL)
    187187                async_hangup(mouse_dev->wheel_sess);
     188        int ret = ddf_fun_unbind(mouse_dev->mouse_fun);
     189        if (ret != EOK) {
     190                usb_log_error("Failed to unbind mouse function.\n");
     191        } else {
     192                ddf_fun_destroy(mouse_dev->mouse_fun);
     193                /* Prevent double free */
     194                mouse_dev->wheel_fun->driver_data = NULL;
     195        }
     196
     197        ret = ddf_fun_unbind(mouse_dev->wheel_fun);
     198        if (ret != EOK) {
     199                usb_log_error("Failed to unbind wheel function.\n");
     200        } else {
     201                ddf_fun_destroy(mouse_dev->wheel_fun);
     202        }
    188203}
    189204
     
    338353                usb_log_error("Could not bind DDF function: %s.\n",
    339354                    str_error(rc));
    340                 ddf_fun_destroy(fun);
    341355                return rc;
    342356        }
     
    349363                    "Could not add DDF function to category %s: %s.\n",
    350364                    HID_MOUSE_CATEGORY, str_error(rc));
    351                 ddf_fun_destroy(fun);
    352                 return rc;
    353         }
     365                return rc;
     366        }
     367        mouse->mouse_fun = fun;
    354368
    355369        /*
     
    376390                usb_log_error("Could not bind DDF function: %s.\n",
    377391                    str_error(rc));
    378                 ddf_fun_destroy(fun);
    379392                return rc;
    380393        }
     
    387400                    "Could not add DDF function to category %s: %s.\n",
    388401                    HID_MOUSE_WHEEL_CATEGORY, str_error(rc));
    389                 ddf_fun_destroy(fun);
    390                 return rc;
    391         }
     402                return rc;
     403        }
     404        mouse->wheel_fun = fun;
    392405
    393406        return EOK;
     
    511524{
    512525        if (data != NULL) {
    513                 usb_mouse_destroy((usb_mouse_t *)data);
     526                usb_mouse_destroy(data);
    514527        }
    515528}
  • uspace/drv/bus/usb/usbhid/mouse/mousedev.h

    rc5b6db53 rf2964e45  
    5555
    5656        ddf_dev_ops_t ops;
     57        /* DDF mouse function */
     58        ddf_fun_t *mouse_fun;
     59        /* DDF mouse function */
     60        ddf_fun_t *wheel_fun;
    5761} usb_mouse_t;
    5862
Note: See TracChangeset for help on using the changeset viewer.