1. 09 Jan, 2019 1 commit
  2. 16 Nov, 2018 1 commit
  3. 07 Nov, 2018 3 commits
    • Xulin Sun's avatar
      rtc: pcf2127: fix a kmemleak caused in pcf2127_i2c_gather_write · 9bde0afb
      Xulin Sun authored
      pcf2127_i2c_gather_write() allocates memory as local variable
      for i2c_master_send(), after finishing the master transfer,
      the allocated memory should be freed. The kmemleak is reported:
      
      unreferenced object 0xffff80231e7dba80 (size 64):
        comm "hwclock", pid 27762, jiffies 4296880075 (age 356.944s)
        hex dump (first 32 bytes):
          03 00 12 03 19 02 11 13 00 80 98 18 00 00 ff ff ................
          00 50 00 00 00 00 00 00 02 00 00 00 00 00 00 00 .P..............
        backtrace:
          [<ffff000008221398>] create_object+0xf8/0x278
          [<ffff000008a96264>] kmemleak_alloc+0x74/0xa0
          [<ffff00000821070c>] __kmalloc+0x1ac/0x348
          [<ffff0000087ed1dc>] pcf2127_i2c_gather_write+0x54/0xf8
          [<ffff0000085fd9d4>] _regmap_raw_write+0x464/0x850
          [<ffff0000085fe3f4>] regmap_bulk_write+0x1a4/0x348
          [<ffff0000087ed32c>] pcf2127_rtc_set_time+0xac/0xe8
          [<ffff0000087eaad8>] rtc_set_time+0x80/0x138
          [<ffff0000087ebfb0>] rtc_dev_ioctl+0x398/0x610
          [<ffff00000823f2c0>] do_vfs_ioctl+0xb0/0x848
          [<ffff00000823fae4>] SyS_ioctl+0x8c/0xa8
          [<ffff000008083ac0>] el0_svc_naked+0x34/0x38
          [<ffffffffffffffff>] 0xffffffffffffffff
      Signed-off-by: default avatarXulin Sun <xulin.sun@windriver.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      9bde0afb
    • Maciej W. Rozycki's avatar
      rtc: hctosys: Add missing range error reporting · 7ce9a992
      Maciej W. Rozycki authored
      Fix an issue with the 32-bit range error path in `rtc_hctosys' where no
      error code is set and consequently the successful preceding call result
      from `rtc_read_time' is propagated to `rtc_hctosys_ret'.  This in turn
      makes any subsequent call to `hctosys_show' incorrectly report in sysfs
      that the system time has been set from this RTC while it has not.
      
      Set the error to ERANGE then if we can't express the result due to an
      overflow.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Fixes: b3a5ac42 ("rtc: hctosys: Ensure system time doesn't overflow time_t")
      Cc: stable@vger.kernel.org # 4.17+
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      7ce9a992
    • Hans de Goede's avatar
      rtc: cmos: Do not export alarm rtc_ops when we do not support alarms · fbb974ba
      Hans de Goede authored
      When there is no IRQ configured for the RTC, the rtc-cmos code does not
      support alarms, all alarm rtc_ops fail with -EIO / -EINVAL.
      
      The rtc-core expects a rtc driver which does not support rtc alarms to
      not have alarm ops at all. Otherwise the wakealarm sysfs attr will read
      as empty rather then returning an error, making it impossible for
      userspace to find out beforehand if alarms are supported.
      
      A system without an IRQ for the RTC before this patch:
      [root@localhost ~]# cat /sys/class/rtc/rtc0/wakealarm
      [root@localhost ~]#
      
      After this patch:
      [root@localhost ~]# cat /sys/class/rtc/rtc0/wakealarm
      cat: /sys/class/rtc/rtc0/wakealarm: No such file or directory
      [root@localhost ~]#
      
      This fixes gnome-session + systemd trying to use suspend-then-hibernate,
      which causes systemd to abort the suspend when writing the RTC alarm fails.
      
      BugLink: https://github.com/systemd/systemd/issues/9988Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      fbb974ba
  4. 25 Oct, 2018 5 commits
  5. 22 Oct, 2018 3 commits
  6. 16 Oct, 2018 2 commits
  7. 04 Oct, 2018 2 commits
    • Maciej W. Rozycki's avatar
      rtc: cmos: Remove the `use_acpi_alarm' module parameter for !ACPI · bc51098c
      Maciej W. Rozycki authored
      Fix a problem with commit 311ee9c1 ("rtc: cmos: allow using ACPI for
      RTC alarm instead of HPET") defining `use_acpi_alarm' module parameter
      even for non-ACPI platforms, which ignore it.  Wrap the definition into
      #ifdef CONFIG_ACPI and use a static inline wrapper function, hardcoded
      to return 0 and consequently optimized away for !ACPI, following the
      existing pattern with HPET handling functions.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Fixes: 311ee9c1 ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET")
      Cc: stable@vger.kernel.org # 4.18+
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      bc51098c
    • Maciej W. Rozycki's avatar
      rtc: cmos: Fix non-ACPI undefined reference to `hpet_rtc_interrupt' · d197a253
      Maciej W. Rozycki authored
      Fix a commit 311ee9c1 ("rtc: cmos: allow using ACPI for RTC alarm
      instead of HPET") `rtc-cmos' regression causing a link error:
      
      drivers/rtc/rtc-cmos.o: In function `cmos_platform_probe':
      rtc-cmos.c:(.init.text+0x33c): undefined reference to `hpet_rtc_interrupt'
      rtc-cmos.c:(.init.text+0x3f4): undefined reference to `hpet_rtc_interrupt'
      
      with non-ACPI platforms using this driver.  The cause is the change of
      the condition guarding the use of `hpet_rtc_interrupt'.
      
      Previously it was a call to `is_hpet_enabled'.  That function is static
      inline and has a hardcoded 0 result for non-ACPI platforms, which imply
      !HPET_EMULATE_RTC.  Consequently the compiler optimized the whole block
      away including the reference to `hpet_rtc_interrupt', which never made
      it to the link stage.
      
      Now the guarding condition is a call to `use_hpet_alarm', which is not
      static inline and therefore the compiler may not be able to prove that
      it actually always returns 0 for non-ACPI platforms.  Consequently the
      build breaks with an unsatisfied reference, because `hpet_rtc_interrupt'
      is nowhere defined at link time.
      
      Fix the problem by marking `use_hpet_alarm' inline.  As the `inline'
      keyword serves as an optimization hint rather than a requirement the
      compiler is still free to choose whether inlining will be beneficial or
      not for ACPI platforms.
      Signed-off-by: default avatarMaciej W. Rozycki <macro@linux-mips.org>
      Fixes: 311ee9c1 ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET")
      Cc: stable@vger.kernel.org # 4.18+
      Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      d197a253
  8. 03 Oct, 2018 2 commits
  9. 28 Sep, 2018 21 commits