1. 17 Mar, 2018 2 commits
    • Alexandre Belloni's avatar
      rtc: rk808: fix possible race condition · 201fac95
      Alexandre Belloni authored
      The probe function is not allowed to fail after registering the RTC because
      the following may happen:
      
      CPU0:                                CPU1:
      sys_load_module()
       do_init_module()
        do_one_initcall()
         cmos_do_probe()
          rtc_device_register()
           __register_chrdev()
           cdev->owner = struct module*
                                           open("/dev/rtc0")
          rtc_device_unregister()
        module_put()
        free_module()
         module_free(mod->module_core)
         /* struct module *module is now
            freed */
                                            chrdev_open()
                                             spin_lock(cdev_lock)
                                             cdev_get()
                                              try_module_get()
                                               module_is_live()
                                               /* dereferences already
                                                  freed struct module* */
      
      Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
      as late as possible.
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      201fac95
    • Alexandre Belloni's avatar
      rtc: rk808: remove useless debug message · 4cda172b
      Alexandre Belloni authored
      At probe time, printing a message when the time is invalid doesn't have
      much value. Also, as the comment suggest, this is a leftover from
      development wherhe this was used to set the RTc to a default time.
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      4cda172b
  2. 02 Mar, 2018 17 commits
  3. 01 Mar, 2018 21 commits