Re: [PATCH] pcmcia: cs: Replace manual mutex locking with guard(mutex)

From: kernel test robot

Date: Wed Jun 03 2026 - 13:56:11 EST


Hi Maxwell,

kernel test robot noticed the following build warnings:

[auto build test WARNING on linus/master]
[also build test WARNING on v7.1-rc6 next-20260602]
[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/Maxwell-Doose/pcmcia-cs-Replace-manual-mutex-locking-with-guard-mutex/20260603-144020
base: linus/master
patch link: https://lore.kernel.org/r/20260603062714.45848-1-m32285159%40gmail.com
patch subject: [PATCH] pcmcia: cs: Replace manual mutex locking with guard(mutex)
config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260603/202606031924.nEoqNaNq-lkp@xxxxxxxxx/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project f43d6834093b19baf79beda8c0337ab020ac5f17)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260603/202606031924.nEoqNaNq-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202606031924.nEoqNaNq-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/pcmcia/cs.c:592:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
592 | if (sysfs_events) {
| ^~~~~~~~~~~~
drivers/pcmcia/cs.c:621:9: note: uninitialized use occurs here
621 | return ret;
| ^~~
drivers/pcmcia/cs.c:592:2: note: remove the 'if' if its condition is always true
592 | if (sysfs_events) {
| ^~~~~~~~~~~~~~~~~
drivers/pcmcia/cs.c:585:9: note: initialize the variable 'ret' to silence this warning
585 | int ret;
| ^
| = 0
1 warning generated.


vim +592 drivers/pcmcia/cs.c

581
582 static int pccardd_helper(struct pcmcia_socket *skt, unsigned int events,
583 unsigned int sysfs_events)
584 {
585 int ret;
586
587 guard(mutex)(&skt->skt_mutex);
588
589 if (events & SS_DETECT)
590 socket_detect_change(skt);
591
> 592 if (sysfs_events) {
593 if (sysfs_events & PCMCIA_UEVENT_EJECT)
594 socket_remove(skt);
595 if (sysfs_events & PCMCIA_UEVENT_INSERT)
596 socket_insert(skt);
597 if ((sysfs_events & PCMCIA_UEVENT_SUSPEND) &&
598 !(skt->state & SOCKET_CARDBUS)) {
599 if (skt->callback)
600 ret = skt->callback->suspend(skt);
601 else
602 ret = 0;
603 if (!ret) {
604 socket_suspend(skt);
605 msleep(100);
606 }
607 }
608 if ((sysfs_events & PCMCIA_UEVENT_RESUME) &&
609 !(skt->state & SOCKET_CARDBUS)) {
610 ret = socket_resume(skt);
611 if (!ret && skt->callback)
612 skt->callback->resume(skt);
613 }
614 if ((sysfs_events & PCMCIA_UEVENT_REQUERY) &&
615 !(skt->state & SOCKET_CARDBUS)) {
616 if (!ret && skt->callback)
617 skt->callback->requery(skt);
618 }
619 }
620
621 return ret;
622 }
623

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