lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202105110342.Oembupaq-lkp@intel.com>
Date:   Tue, 11 May 2021 03:45:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
        Matti Vaittinen <mazziesaccount@...il.com>
Cc:     kbuild-all@...ts.01.org, Mark Brown <broonie@...nel.org>,
        Kees Cook <keescook@...omium.org>,
        Andy Shevchenko <andy.shevchenko@...il.com>,
        Zhang Rui <rui.zhang@...el.com>,
        Guenter Roeck <linux@...ck-us.net>,
        "agross@...nel.org" <agross@...nel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        linux-power <linux-power@...rohmeurope.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 05/10] regulator: IRQ based event/error notification
 helpers

Hi Matti,

I love your patch! Yet something to improve:

[auto build test ERROR on 6efb943b8616ec53a5e444193dccf1af9ad627b5]

url:    https://github.com/0day-ci/linux/commits/Matti-Vaittinen/Extend-regulator-notification-support/20210510-203125
base:   6efb943b8616ec53a5e444193dccf1af9ad627b5
config: i386-randconfig-s002-20210510 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/904edb46fa37ac86bc1e7a1629141e037f45ebed
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Matti-Vaittinen/Extend-regulator-notification-support/20210510-203125
        git checkout 904edb46fa37ac86bc1e7a1629141e037f45ebed
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:12,
                    from arch/x86/include/asm/percpu.h:27,
                    from arch/x86/include/asm/current.h:6,
                    from include/linux/sched.h:12,
                    from include/linux/ratelimit.h:6,
                    from include/linux/dev_printk.h:16,
                    from include/linux/device.h:15,
                    from drivers/regulator/irq_helpers.c:10:
   drivers/regulator/irq_helpers.c: In function 'regulator_notifier_isr':
   include/linux/bitops.h:35:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
      35 |  for ((bit) = find_first_bit((addr), (size));  \
         |  ^~~
   drivers/regulator/irq_helpers.c:242:3: note: in expansion of macro 'for_each_set_bit'
     242 |   for_each_set_bit(j, &stat->notifs, BITS_PER_TYPE(stat->notifs))
         |   ^~~~~~~~~~~~~~~~
   drivers/regulator/irq_helpers.c:244:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
     244 |    pr_dbg("Sending regulator notification EVT 0x%lx\r\n",
         |    ^~~~~~
>> drivers/regulator/irq_helpers.c:244:4: error: implicit declaration of function 'pr_dbg'; did you mean 'pr_debug'? [-Werror=implicit-function-declaration]
     244 |    pr_dbg("Sending regulator notification EVT 0x%lx\r\n",
         |    ^~~~~~
         |    pr_debug
   cc1: some warnings being treated as errors


vim +244 drivers/regulator/irq_helpers.c

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

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

Download attachment ".config.gz" of type "application/gzip" (34105 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ