Re: [PATCH V4 4/6] slim: qcom: Add Qualcomm Slimbus controller driver

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

 



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.

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux