[bug report] mfd: ezx-pcap: Replace mutex_lock with spin_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Fuqian Huang,

The patch b65dc4f6b339: "mfd: ezx-pcap: Replace mutex_lock with
spin_lock" from Aug 13, 2019 (linux-next), leads to the following
Smatch static checker warning:

drivers/mfd/ezx-pcap.c:102 ezx_pcap_read() warn: sleeping in atomic context
drivers/mfd/ezx-pcap.c:102 ezx_pcap_read() warn: sleeping in IRQ context

drivers/mfd/ezx-pcap.c
    93 int ezx_pcap_read(struct pcap_chip *pcap, u8 reg_num, u32 *value)
    94 {
    95         unsigned long flags;
    96         int ret;
    97 
    98         spin_lock_irqsave(&pcap->io_lock, flags);
               ^^^^^^^^^^^^^^^^^^
Taking a spinlock.

    99         *value = PCAP_REGISTER_READ_OP_BIT
    100                 | (reg_num << PCAP_REGISTER_ADDRESS_SHIFT);
    101 
--> 102         ret = ezx_pcap_putget(pcap, value);

My static checker agrees with you that this is an IRQ function but the
ezx_pcap_putget() function takes a mutex and we can't do that from an
IRQ function.

    103         spin_unlock_irqrestore(&pcap->io_lock, flags);
    104 
    105         return ret;
    106 }

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux