linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: miaoqing@codeaurora.org
Cc: ath9k-devel@qca.qualcomm.com, linux-gpio@vger.kernel.org
Subject: [bug report] ath9k: make GPIO API to support both of WMAC and SOC
Date: Mon, 2 Aug 2021 16:18:50 +0300	[thread overview]
Message-ID: <20210802131850.GA2459@kili> (raw)

Hello Miaoqing Pan,

The patch b2d70d4944c1: "ath9k: make GPIO API to support both of WMAC
and SOC" from Mar 7, 2016, leads to the following static checker
warning:

	drivers/gpio/gpiolib.c:1960 gpiod_free_commit()
	warn: sleeping in atomic context

drivers/net/wireless/ath/ath9k/hw.c
  2728  static void ath9k_hw_gpio_cfg_soc(struct ath_hw *ah, u32 gpio, bool out,
  2729                                    const char *label)
  2730  {
  2731          if (ah->caps.gpio_requested & BIT(gpio))
  2732                  return;
  2733  
  2734          /* may be requested by BSP, free anyway */
  2735          gpio_free(gpio);
                ^^^^^^^^^^^^^^^^
The problem is that gpio_free() can sleep and the cfg_soc() can be
called with spinlocks held.  One problematic call tree is:

--> ath_reset_internal() takes &sc->sc_pcu_lock spin lock
    --> ath9k_hw_reset()
        --> ath9k_hw_gpio_request_in()
            --> ath9k_hw_gpio_request()
                --> ath9k_hw_gpio_cfg_soc()

  2736  
  2737          if (gpio_request_one(gpio, out ? GPIOF_OUT_INIT_LOW : GPIOF_IN, label))
  2738                  return;
  2739  
  2740          ah->caps.gpio_requested |= BIT(gpio);
  2741  }

regards,
dan carpenter

                 reply	other threads:[~2021-08-02 13:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210802131850.GA2459@kili \
    --to=dan.carpenter@oracle.com \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=miaoqing@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).