Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604066

Re: [PATCH] extcon: Allow registering a single notifier for all cables on an extcon_dev

From Hans de Goede <hdegoede@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] extcon: Allow registering a single notifier for all cables on an extcon_dev
Date 2017-03-19 19:30 +0100
Message-ID <tmNKx-19Q-5@gated-at.bofh.it> (permalink)
References <tmIKR-638-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

On 19-03-17 14:06, kbuild test robot wrote:
> Hi Hans,
>
> [auto build test WARNING on chanwoo-extcon/extcon-next]
> [also build test WARNING on v4.11-rc2 next-20170310]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Hans-de-Goede/extcon-Allow-registering-a-single-notifier-for-all-cables-on-an-extcon_dev/20170319-204610
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next
> config: i386-randconfig-x072-201712 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=i386
>
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
>
> All warnings (new ones prefixed by >>):
>
>    drivers/extcon/extcon.c: In function 'extcon_unregister_notifier':
>>> drivers/extcon/extcon.c:962:48: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
>       ret = raw_notifier_chain_unregister(&edev->nh[idx], nb);

I was already afraid this would happen, I was actually pleasantly surprised
when I did not get this warning during my own testing. But it seems other
compiler versions are not as smart as the very recent gcc I'm using.

I'll send a v2 fixing this.

Regards,

Hans




>                                                    ^
>
> vim +/idx +962 drivers/extcon/extcon.c
>
> 74c5d09b drivers/extcon/extcon_class.c Donggeun Kim  2012-04-20  946  				struct notifier_block *nb)
> 74c5d09b drivers/extcon/extcon_class.c Donggeun Kim  2012-04-20  947  {
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  948  	unsigned long flags;
> 046050f6 drivers/extcon/extcon.c       Chanwoo Choi  2015-05-19  949  	int ret, idx;
> 046050f6 drivers/extcon/extcon.c       Chanwoo Choi  2015-05-19  950
> 7eae43ae drivers/extcon/extcon.c       Chanwoo Choi  2015-06-21  951  	if (!edev || !nb)
> 7eae43ae drivers/extcon/extcon.c       Chanwoo Choi  2015-06-21  952  		return -EINVAL;
> 7eae43ae drivers/extcon/extcon.c       Chanwoo Choi  2015-06-21  953
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  954  	if ((int)id != -1) {
> 046050f6 drivers/extcon/extcon.c       Chanwoo Choi  2015-05-19  955  		idx = find_cable_index_by_id(edev, id);
> a05f44c8 drivers/extcon/extcon.c       Stephen Boyd  2016-06-23  956  		if (idx < 0)
> a05f44c8 drivers/extcon/extcon.c       Stephen Boyd  2016-06-23  957  			return idx;
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  958  	}
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  959
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  960  	spin_lock_irqsave(&edev->lock, flags);
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  961  	if ((int)id != -1)
> 046050f6 drivers/extcon/extcon.c       Chanwoo Choi  2015-05-19 @962  		ret = raw_notifier_chain_unregister(&edev->nh[idx], nb);
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  963  	else
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  964  		ret = raw_notifier_chain_unregister(&edev->nh_all, nb);
> 8f482488 drivers/extcon/extcon.c       Hans de Goede 2017-03-17  965
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  966  	spin_unlock_irqrestore(&edev->lock, flags);
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  967
> 66bee35f drivers/extcon/extcon.c       Hans de Goede 2015-03-21  968  	return ret;
> 74c5d09b drivers/extcon/extcon_class.c Donggeun Kim  2012-04-20  969  }
> 74c5d09b drivers/extcon/extcon_class.c Donggeun Kim  2012-04-20  970  EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
>
> :::::: The code at line 962 was first introduced by commit
> :::::: 046050f6e623e442e9c71c525462ebd395dae526 extcon: Update the prototype of extcon_register_notifier() with enum extcon
>
> :::::: TO: Chanwoo Choi <cw00.choi@samsung.com>
> :::::: CC: Chanwoo Choi <cw00.choi@samsung.com>
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] extcon: Allow registering a single notifier for all  cables on an extcon_dev Hans de Goede <hdegoede@redhat.com> - 2017-03-19 19:30 +0100

csiph-web