lkml.org 
[lkml]   [2016]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V4 4/6] slim: qcom: Add Qualcomm Slimbus controller driver
On Sat, Feb 06, 2016 at 11:44:23AM -0700, Sagar Dharia wrote:

>
> +if SLIMBUS
> +config SLIM_QCOM_CTRL
> + tristate "Qualcomm Slimbus Manager Component"
> + depends on SLIMBUS
> + default n
> + help

n is the default.

> +static irqreturn_t msm_slim_interrupt(int irq, void *d)
> +{
> + struct msm_slim_ctrl *dev = d;
> + u32 stat = readl_relaxed(dev->base + MGR_INT_STAT);
> + int err = 0;

> + if (stat & MGR_INT_TX_MSG_SENT || stat & MGR_INT_TX_NACKED_2) {

> + if (stat & MGR_INT_RX_MSG_RCVD) {

> + }

> + /**
> + * All interrupts are handled: complex RX messages requiring more work
> + * are queued to work-queue, others are handled above
> + */
> + return IRQ_HANDLED;

This unconditionally returns IRQ_HANDLED even if no interrupts were
flagged. This will break if the interrupt gets shared in some hardware
design or if something goes wrong with the hardware.

> + ret = devm_request_irq(&pdev->dev, dev->irq, msm_slim_interrupt,
> + IRQF_TRIGGER_HIGH, "msm_slim_irq", dev);
> + if (ret) {
> + dev_err(&pdev->dev, "request IRQ failed\n");
> + goto err_request_irq_failed;
> + }

Are you sure this is safe and we don't deallocate things the interrupt
handler uses before we disable the interrupt?

> + ret = clk_prepare_enable(hclk);
> + if (ret)
> + goto err_hclk_enable_failed;
> +
> + ret = clk_prepare_enable(rclk);
> + if (ret)
> + goto err_rclk_enable_failed;

The remove path doesn't disable these.

> + /* Register with framework before enabling frame, clock */
> + ret = slim_register_controller(&dev->ctrl);
> + if (ret) {
> + dev_err(dev->dev, "error adding controller\n");
> + goto err_ctrl_failed;
> + }

Should we have a devm_ version of slim_register_controller()? I'd also
expect this to be the last thing we do in probe, things may start using
the device before we've finished initializing it.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2016-03-05 14:21    [W:0.112 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site