All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [RFC PATCH 3/7] regulator: IRQ based event/error notification helpers
Date: Fri, 12 Feb 2021 02:47:48 +0800	[thread overview]
Message-ID: <202102120245.avHObUS1-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 10774 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <3daf0531910c25d8b0da3964778ae2a6c9049d43.1613042245.git.matti.vaittinen@fi.rohmeurope.com>
References: <3daf0531910c25d8b0da3964778ae2a6c9049d43.1613042245.git.matti.vaittinen@fi.rohmeurope.com>
TO: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>, Matti Vaittinen <mazziesaccount@gmail.com>

Hi Matti,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on regulator/for-next]
[also build test WARNING on v5.11-rc7 next-20210211]
[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]

url:    https://github.com/0day-ci/linux/commits/Matti-Vaittinen/Extend-regulator-notification-support/20210211-204336
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: x86_64-randconfig-m001-20210209 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/regulator/irq_helpers.c:194 regulator_notifier_isr() error: uninitialized symbol 'ret'.

vim +/ret +194 drivers/regulator/irq_helpers.c

1844ad67f3ebe1 Matti Vaittinen 2021-02-11  154  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  155  static irqreturn_t regulator_notifier_isr(int irq, void *data)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  156  {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  157  	struct regulator_irq *h = data;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  158  	struct regulator_irq_desc *d;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  159  	struct regulator_irq_data *rid;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  160  	unsigned long rdev_map = 0;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  161  	int num_rdevs;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  162  	int ret, i, j;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  163  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  164  	d = &h->desc;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  165  	rid = &h->rdata;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  166  	num_rdevs = rid->num_states;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  167  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  168  	if (d->fatal_cnt)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  169  		h->retry_cnt++;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  170  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  171  	/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  172  	 * we spare few cycles by not clearing statuses prior this call.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  173  	 * The IC driver must initialize the status buffers for rdevs
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  174  	 * which it indicates having active events via rdev_map.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  175  	 *
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  176  	 * Maybe we should just to be on a safer side(?)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  177  	 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  178  	if (d->map_event)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  179  		ret = d->map_event(irq, rid, &rdev_map);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  180  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  181  	/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  182  	 * If status reading fails (which is unlikely) we don't ack/disable
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  183  	 * IRQ but just increase fail count and retry when IRQ fires again.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  184  	 * If retry_count exceeds given safety limit we call IC specific die
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  185  	 * handler which can try disabling regulator(s).
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  186  	 *
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  187  	 * If no die handler is given we will just bug() as a last resort.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  188  	 *
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  189  	 * We could try disabling all associated rdevs - but we might shoot
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  190  	 * ourself in the head and leave problematic regulator enabled. So
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  191  	 * if IC has no die-handler populated we just assume the regulator
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  192  	 * can't be disabled.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  193  	 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11 @194  	if (unlikely(ret == REGULATOR_FAILED_RETRY))
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  195  		goto fail_out;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  196  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  197  	h->retry_cnt = 0;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  198  	/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  199  	 * Let's not disable IRQ if there was no status bits for us. We'd
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  200  	 * better leave spurious IRQ handling to genirq
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  201  	 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  202  	if (ret || !rdev_map)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  203  		return IRQ_NONE;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  204  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  205  	/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  206  	 * Some events are bogus if regulator is disabled. Skip such events
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  207  	 * if all relevant regulators are disabled
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  208  	 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  209  	if (d->skip_off) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  210  		int skip = 1;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  211  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  212  		for_each_set_bit(i, &rdev_map, num_rdevs) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  213  			struct regulator_dev *rdev;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  214  			const struct regulator_ops *ops;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  215  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  216  			rdev = rid->states[i].rdev;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  217  			ops = rdev->desc->ops;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  218  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  219  			/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  220  			 * If any of the flagged regulators is enabled we do
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  221  			 * handle this
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  222  			 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  223  			if (ops->is_enabled(rdev)) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  224  				skip = 0;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  225  				break;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  226  			}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  227  		}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  228  		if (skip)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  229  			return IRQ_NONE;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  230  	}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  231  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  232  	/* Disable IRQ if HW keeps line asserted */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  233  	if (d->irq_off_ms)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  234  		disable_irq_nosync(irq);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  235  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  236  	/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  237  	 * IRQ seems to be for us. Let's fire correct notifiers / store error
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  238  	 * flags
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  239  	 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  240  	for_each_set_bit(i, &rdev_map, num_rdevs) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  241  		struct regulator_err_state *stat;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  242  		int len;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  243  		struct regulator_dev *rdev;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  244  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  245  		stat = &rid->states[i];
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  246  		len = sizeof(stat->notifs);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  247  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  248  		rdev = stat->rdev;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  249  		for_each_set_bit(j, &stat->notifs, 8 * len)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  250  			regulator_notifier_call_chain(rdev, 1 << (j - 1), NULL);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  251  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  252  		rdev_flag_err(rdev, stat->errors);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  253  	}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  254  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  255  	if (d->irq_off_ms) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  256  		if (!d->high_prio)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  257  			schedule_delayed_work(&h->isr_work,
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  258  					      msecs_to_jiffies(d->irq_off_ms));
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  259  		else
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  260  			mod_delayed_work(system_highpri_wq,
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  261  					 &h->isr_work,
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  262  					 msecs_to_jiffies(d->irq_off_ms));
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  263  	}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  264  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  265  	return IRQ_HANDLED;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  266  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  267  fail_out:
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  268  	if (d->fatal_cnt && h->retry_cnt > d->fatal_cnt) {
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  269  		if (d->die)
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  270  			ret = d->die(rid);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  271  
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  272  		/*
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  273  		 * If die() failed or was not implemented just BUG() as last
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  274  		 * attemt to save HW.
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  275  		 */
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  276  		BUG_ON(ret);
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  277  	}
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  278  	return IRQ_NONE;
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  279  }
1844ad67f3ebe1 Matti Vaittinen 2021-02-11  280  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29633 bytes --]

             reply	other threads:[~2021-02-11 18:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11 18:47 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-02-11 12:33 [RFC PATCH 0/7] Extend regulator notification support Matti Vaittinen
2021-02-11 12:35 ` [RFC PATCH 3/7] regulator: IRQ based event/error notification helpers Matti Vaittinen
2021-02-11 14:40   ` kernel test robot
2021-02-12  9:33   ` Vaittinen, Matti
2021-02-12 13:56     ` Mark Brown
2021-02-15 10:25   ` Vaittinen, Matti
2021-02-15 11:11   ` Dan Carpenter
2021-02-15 11:11     ` Dan Carpenter

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=202102120245.avHObUS1-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.