All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: lkundrak@v3.sk
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] Platform: OLPC: Add XO-1.75 EC driver
Date: Mon, 4 Oct 2021 16:53:48 +0300	[thread overview]
Message-ID: <20211004135348.GA12255@kili> (raw)

Hello Lubomir Rintel,

The patch 0c3d931b3ab9: "Platform: OLPC: Add XO-1.75 EC driver" from
May 13, 2019, leads to the following Smatch static checker warning:

	drivers/platform/olpc/olpc-xo175-ec.c:363 olpc_xo175_ec_complete()
	warn: sleeping in atomic context

drivers/platform/olpc/olpc-xo175-ec.c
    350         case CHAN_SWITCH:
    351                 spin_lock_irqsave(&priv->cmd_state_lock, flags);
                        ^^^^^^^^^^^^^^^^^
Takes a spinlock

    352 
    353                 if (!priv->cmd_running) {
    354                         /* Just go with the flow */
    355                         dev_err(dev, "spurious SWITCH packet\n");
    356                         memset(&priv->cmd, 0, sizeof(priv->cmd));
    357                         priv->cmd.command = CMD_ECHO;
    358                 }
    359 
    360                 priv->cmd_state = CMD_STATE_CMD_IN_TX_FIFO;
    361 
    362                 /* Throw command into TxFIFO */
--> 363                 gpiod_set_value_cansleep(priv->gpio_cmd, 0);
                                        ^^^^^^^^
Can't sleep under spinlock.

    364                 olpc_xo175_ec_send_command(priv, &priv->cmd, sizeof(priv->cmd));
    365 
    366                 spin_unlock_irqrestore(&priv->cmd_state_lock, flags);
    367                 return;
    368 
    369         case CHAN_CMD_RESP:
    370                 spin_lock_irqsave(&priv->cmd_state_lock, flags);
    371 
    372                 if (!priv->cmd_running) {
    373                         dev_err(dev, "spurious response packet\n");

regards,
dan carpenter

                 reply	other threads:[~2021-10-04 13:54 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=20211004135348.GA12255@kili \
    --to=dan.carpenter@oracle.com \
    --cc=lkundrak@v3.sk \
    --cc=platform-driver-x86@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.