From: Dan Carpenter <dan.carpenter@oracle.com>
To: andriy.shevchenko@linux.intel.com
Cc: linux-spi@vger.kernel.org
Subject: [bug report] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places
Date: Wed, 21 Jul 2021 04:32:46 -0700 [thread overview]
Message-ID: <20210721113246.GA24694@kili> (raw)
Hello Andy Shevchenko,
The patch 3bbdc083262d: "spi: pxa2xx: Reuse int_stop_and_reset() in
couple of places" from Jul 19, 2021, leads to the following static
checker warning:
drivers/spi/spi-pxa2xx.c:774 ssp_int()
error: we previously assumed 'drv_data->controller->cur_msg' could be null (see line 773)
drivers/spi/spi-pxa2xx.c
731 static irqreturn_t ssp_int(int irq, void *dev_id)
732 {
733 struct driver_data *drv_data = dev_id;
734 u32 sccr1_reg;
735 u32 mask = drv_data->mask_sr;
736 u32 status;
737
738 /*
739 * The IRQ might be shared with other peripherals so we must first
740 * check that are we RPM suspended or not. If we are we assume that
741 * the IRQ was not for us (we shouldn't be RPM suspended when the
742 * interrupt is enabled).
743 */
744 if (pm_runtime_suspended(drv_data->ssp->dev))
745 return IRQ_NONE;
746
747 /*
748 * If the device is not yet in RPM suspended state and we get an
749 * interrupt that is meant for another device, check if status bits
750 * are all set to one. That means that the device is already
751 * powered off.
752 */
753 status = pxa2xx_spi_read(drv_data, SSSR);
754 if (status == ~0)
755 return IRQ_NONE;
756
757 sccr1_reg = pxa2xx_spi_read(drv_data, SSCR1);
758
759 /* Ignore possible writes if we don't need to write */
760 if (!(sccr1_reg & SSCR1_TIE))
761 mask &= ~SSSR_TFS;
762
763 /* Ignore RX timeout interrupt if it is disabled */
764 if (!(sccr1_reg & SSCR1_TINTE))
765 mask &= ~SSSR_TINT;
766
767 if (!(status & mask))
768 return IRQ_NONE;
769
770 pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg & ~drv_data->int_cr1);
771 pxa2xx_spi_write(drv_data, SSCR1, sccr1_reg);
772
773 if (!drv_data->controller->cur_msg) {
--> 774 handle_bad_msg(drv_data);
^^^^^^^^^^^^^^^^^^^^^^^^
We can't reset with a NULL drv_data->controller->cur_msg.
775 /* Never fail */
776 return IRQ_HANDLED;
777 }
778
779 return drv_data->transfer_handler(drv_data);
780 }
regards,
dan carpenter
next reply other threads:[~2021-07-21 11:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-21 11:32 Dan Carpenter [this message]
2021-07-21 12:15 ` [bug report] spi: pxa2xx: Reuse int_stop_and_reset() in couple of places Andy Shevchenko
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=20210721113246.GA24694@kili \
--to=dan.carpenter@oracle.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-spi@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 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).