All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: Re: [PATCH] drivers: rtc: handle OTF clock changes
Date: Fri, 7 Aug 2026 20:35:16 +0800	[thread overview]
Message-ID: <202608072059.hZ2oY5u0-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20260624123103.3523728-1-enachman@marvell.com>
References: <20260624123103.3523728-1-enachman@marvell.com>
TO: Elad Nachman <enachman@marvell.com>
TO: alexandre.belloni@bootlin.com
TO: linux-rtc@vger.kernel.org
TO: linux-kernel@vger.kernel.org
CC: enachman@marvell.com

Hi Elad,

kernel test robot noticed the following build warnings:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on linus/master v7.2-rc6 next-20260806]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Elad-Nachman/drivers-rtc-handle-OTF-clock-changes/20260806-231215
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20260624123103.3523728-1-enachman%40marvell.com
patch subject: [PATCH] drivers: rtc: handle OTF clock changes
:::::: branch date: 21 hours ago
:::::: commit date: 21 hours ago
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260807/202608072059.hZ2oY5u0-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608072059.hZ2oY5u0-lkp@intel.com/

smatch warnings:
drivers/rtc/interface.c:163 rtc_set_time() warn: variable dereferenced before check 'rtc' (see line 135)

vim +/rtc +163 drivers/rtc/interface.c

0c86edc0d49706 Alessandro Zummo  2006-03-27  125  
ab6a2d70d18edc David Brownell    2007-05-08  126  int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
0c86edc0d49706 Alessandro Zummo  2006-03-27  127  {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  128  	int err, uie;
37b82b16c5f104 Elad Nachman      2026-06-24  129  	struct rtc_time new_tm;
0c86edc0d49706 Alessandro Zummo  2006-03-27  130  
0c86edc0d49706 Alessandro Zummo  2006-03-27  131  	err = rtc_valid_tm(tm);
0c86edc0d49706 Alessandro Zummo  2006-03-27  132  	if (err != 0)
0c86edc0d49706 Alessandro Zummo  2006-03-27  133  		return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  134  
4c4e5df1f346f7 Baolin Wang       2018-01-08 @135  	err = rtc_valid_range(rtc, tm);
4c4e5df1f346f7 Baolin Wang       2018-01-08  136  	if (err)
4c4e5df1f346f7 Baolin Wang       2018-01-08  137  		return err;
71db049e7355f3 Alexandre Belloni 2018-02-17  138  
989515647e7832 Baolin Wang       2018-01-08  139  	rtc_subtract_offset(rtc, tm);
989515647e7832 Baolin Wang       2018-01-08  140  
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  141  #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  142  	uie = rtc->uie_rtctimer.enabled || rtc->uie_irq_active;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  143  #else
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  144  	uie = rtc->uie_rtctimer.enabled;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  145  #endif
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  146  	if (uie) {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  147  		err = rtc_update_irq_enable(rtc, 0);
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  148  		if (err)
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  149  			return err;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  150  	}
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  151  
0c86edc0d49706 Alessandro Zummo  2006-03-27  152  	err = mutex_lock_interruptible(&rtc->ops_lock);
0c86edc0d49706 Alessandro Zummo  2006-03-27  153  	if (err)
b68bb2632453a9 David Brownell    2008-07-29  154  		return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  155  
0c86edc0d49706 Alessandro Zummo  2006-03-27  156  	if (!rtc->ops)
0c86edc0d49706 Alessandro Zummo  2006-03-27  157  		err = -ENODEV;
bbccf83f6c4e1a Alessandro Zummo  2009-01-06  158  	else if (rtc->ops->set_time)
cd9662094edf41 David Brownell    2007-05-08  159  		err = rtc->ops->set_time(rtc->dev.parent, tm);
606cc43c720bde Alexandre Belloni 2019-03-20  160  	else
bbccf83f6c4e1a Alessandro Zummo  2009-01-06  161  		err = -EINVAL;
0c86edc0d49706 Alessandro Zummo  2006-03-27  162  
37b82b16c5f104 Elad Nachman      2026-06-24 @163  	if (rtc && rtc->ops && rtc->ops->read_time) {
37b82b16c5f104 Elad Nachman      2026-06-24  164  		if (!rtc->ops->read_time(rtc->dev.parent, &new_tm)) {
37b82b16c5f104 Elad Nachman      2026-06-24  165  			pr_debug("new rtc time secs %d mins %d hours %d mday %d mon %d year %d way %d yday %d dst %d\n",
37b82b16c5f104 Elad Nachman      2026-06-24  166  					new_tm.tm_sec, new_tm.tm_min,
37b82b16c5f104 Elad Nachman      2026-06-24  167  					new_tm.tm_hour, new_tm.tm_mday,
37b82b16c5f104 Elad Nachman      2026-06-24  168  					new_tm.tm_mon, new_tm.tm_year,
37b82b16c5f104 Elad Nachman      2026-06-24  169  					new_tm.tm_wday, new_tm.tm_yday,
37b82b16c5f104 Elad Nachman      2026-06-24  170  					new_tm.tm_isdst);
37b82b16c5f104 Elad Nachman      2026-06-24  171  		}
37b82b16c5f104 Elad Nachman      2026-06-24  172  	}
37b82b16c5f104 Elad Nachman      2026-06-24  173  
14d0e347ea2db5 Zoran Markovic    2013-06-26  174  	pm_stay_awake(rtc->dev.parent);
0c86edc0d49706 Alessandro Zummo  2006-03-27  175  	mutex_unlock(&rtc->ops_lock);
5f9679d29c7959 NeilBrown         2011-12-09  176  	/* A timer might have just expired */
5f9679d29c7959 NeilBrown         2011-12-09  177  	schedule_work(&rtc->irqwork);
29a1f599c0cc37 Baolin Wang       2017-12-14  178  
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  179  	if (uie) {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  180  		err = rtc_update_irq_enable(rtc, 1);
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  181  		if (err)
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  182  			return err;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  183  	}
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  184  
29a1f599c0cc37 Baolin Wang       2017-12-14  185  	trace_rtc_set_time(rtc_tm_to_time64(tm), err);
0c86edc0d49706 Alessandro Zummo  2006-03-27  186  	return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  187  }
0c86edc0d49706 Alessandro Zummo  2006-03-27  188  EXPORT_SYMBOL_GPL(rtc_set_time);
0c86edc0d49706 Alessandro Zummo  2006-03-27  189  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Elad Nachman <enachman@marvell.com>,
	alexandre.belloni@bootlin.com, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev, enachman@marvell.com
Subject: Re: [PATCH] drivers: rtc: handle OTF clock changes
Date: Fri, 7 Aug 2026 16:05:43 +0300	[thread overview]
Message-ID: <202608072059.hZ2oY5u0-lkp@intel.com> (raw)
In-Reply-To: <20260624123103.3523728-1-enachman@marvell.com>

Hi Elad,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Elad-Nachman/drivers-rtc-handle-OTF-clock-changes/20260806-231215
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20260624123103.3523728-1-enachman%40marvell.com
patch subject: [PATCH] drivers: rtc: handle OTF clock changes
config: i386-randconfig-141 (https://download.01.org/0day-ci/archive/20260807/202608072059.hZ2oY5u0-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9187-g5189e3fb

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202608072059.hZ2oY5u0-lkp@intel.com/

smatch warnings:
drivers/rtc/interface.c:163 rtc_set_time() warn: variable dereferenced before check 'rtc' (see line 135)

vim +/rtc +163 drivers/rtc/interface.c

ab6a2d70d18edc David Brownell    2007-05-08  126  int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
0c86edc0d49706 Alessandro Zummo  2006-03-27  127  {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  128  	int err, uie;
37b82b16c5f104 Elad Nachman      2026-06-24  129  	struct rtc_time new_tm;
0c86edc0d49706 Alessandro Zummo  2006-03-27  130  
0c86edc0d49706 Alessandro Zummo  2006-03-27  131  	err = rtc_valid_tm(tm);
0c86edc0d49706 Alessandro Zummo  2006-03-27  132  	if (err != 0)
0c86edc0d49706 Alessandro Zummo  2006-03-27  133  		return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  134  
4c4e5df1f346f7 Baolin Wang       2018-01-08 @135  	err = rtc_valid_range(rtc, tm);
4c4e5df1f346f7 Baolin Wang       2018-01-08  136  	if (err)
4c4e5df1f346f7 Baolin Wang       2018-01-08  137  		return err;
71db049e7355f3 Alexandre Belloni 2018-02-17  138  
989515647e7832 Baolin Wang       2018-01-08  139  	rtc_subtract_offset(rtc, tm);
989515647e7832 Baolin Wang       2018-01-08  140  
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  141  #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  142  	uie = rtc->uie_rtctimer.enabled || rtc->uie_irq_active;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  143  #else
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  144  	uie = rtc->uie_rtctimer.enabled;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  145  #endif
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  146  	if (uie) {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  147  		err = rtc_update_irq_enable(rtc, 0);
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  148  		if (err)
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  149  			return err;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  150  	}
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  151  
0c86edc0d49706 Alessandro Zummo  2006-03-27  152  	err = mutex_lock_interruptible(&rtc->ops_lock);
0c86edc0d49706 Alessandro Zummo  2006-03-27  153  	if (err)
b68bb2632453a9 David Brownell    2008-07-29  154  		return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  155  
0c86edc0d49706 Alessandro Zummo  2006-03-27  156  	if (!rtc->ops)
0c86edc0d49706 Alessandro Zummo  2006-03-27  157  		err = -ENODEV;
bbccf83f6c4e1a Alessandro Zummo  2009-01-06  158  	else if (rtc->ops->set_time)
cd9662094edf41 David Brownell    2007-05-08  159  		err = rtc->ops->set_time(rtc->dev.parent, tm);
606cc43c720bde Alexandre Belloni 2019-03-20  160  	else
bbccf83f6c4e1a Alessandro Zummo  2009-01-06  161  		err = -EINVAL;
0c86edc0d49706 Alessandro Zummo  2006-03-27  162  
37b82b16c5f104 Elad Nachman      2026-06-24 @163  	if (rtc && rtc->ops && rtc->ops->read_time) {
                                                            ^^^
There is no point in checking "rtc" after we have already dereferenced
it.

37b82b16c5f104 Elad Nachman      2026-06-24  164  		if (!rtc->ops->read_time(rtc->dev.parent, &new_tm)) {
37b82b16c5f104 Elad Nachman      2026-06-24  165  			pr_debug("new rtc time secs %d mins %d hours %d mday %d mon %d year %d way %d yday %d dst %d\n",
37b82b16c5f104 Elad Nachman      2026-06-24  166  					new_tm.tm_sec, new_tm.tm_min,
37b82b16c5f104 Elad Nachman      2026-06-24  167  					new_tm.tm_hour, new_tm.tm_mday,
37b82b16c5f104 Elad Nachman      2026-06-24  168  					new_tm.tm_mon, new_tm.tm_year,
37b82b16c5f104 Elad Nachman      2026-06-24  169  					new_tm.tm_wday, new_tm.tm_yday,
37b82b16c5f104 Elad Nachman      2026-06-24  170  					new_tm.tm_isdst);
37b82b16c5f104 Elad Nachman      2026-06-24  171  		}
37b82b16c5f104 Elad Nachman      2026-06-24  172  	}
37b82b16c5f104 Elad Nachman      2026-06-24  173  
14d0e347ea2db5 Zoran Markovic    2013-06-26  174  	pm_stay_awake(rtc->dev.parent);
0c86edc0d49706 Alessandro Zummo  2006-03-27  175  	mutex_unlock(&rtc->ops_lock);
5f9679d29c7959 NeilBrown         2011-12-09  176  	/* A timer might have just expired */
5f9679d29c7959 NeilBrown         2011-12-09  177  	schedule_work(&rtc->irqwork);
29a1f599c0cc37 Baolin Wang       2017-12-14  178  
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  179  	if (uie) {
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  180  		err = rtc_update_irq_enable(rtc, 1);
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  181  		if (err)
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  182  			return err;
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  183  	}
7e7c005b4b1f1f Alexandre Belloni 2019-10-21  184  
29a1f599c0cc37 Baolin Wang       2017-12-14  185  	trace_rtc_set_time(rtc_tm_to_time64(tm), err);
0c86edc0d49706 Alessandro Zummo  2006-03-27  186  	return err;
0c86edc0d49706 Alessandro Zummo  2006-03-27  187  }

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


             reply	other threads:[~2026-08-07 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-07 12:35 kernel test robot [this message]
2026-08-07 13:05 ` [PATCH] drivers: rtc: handle OTF clock changes Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2026-06-24 12:31 Elad Nachman
2026-06-24 15:31 ` Alexandre Belloni
2026-06-28 17:34   ` [EXTERNAL] " Elad Nachman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202608072059.hZ2oY5u0-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.