linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crestez Dan Leonard <leonard.crestez@intel.com>
To: Jonathan Cameron <jic23@kernel.org>, linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Daniel Baluta <daniel.baluta@intel.com>
Subject: Re: [RFC] iio: Release irq if set_trigger_state fails
Date: Tue, 3 May 2016 15:24:45 +0300	[thread overview]
Message-ID: <5728988D.1080502@intel.com> (raw)
In-Reply-To: <202d0c23-c592-c891-a1aa-61b4a264c829@kernel.org>

On 05/01/2016 10:11 PM, Jonathan Cameron wrote:
> On 28/04/16 17:40, Crestez Dan Leonard wrote:
>> When attaching a pollfunc iio_trigger_attach_poll_func will allocate a
>> virtual irq and call the driver's set_trigger_state function. Fix error
>> handling to release the irq if set_trigger_state fails.
>>
>> Otherwise when using triggered buffers and the driver's
>> set_trigger_state fails once then the buffer becomes unusable.
>>
>> It is not possible to handle this sort of error by calling
>> iio_trigger_detach_poll_func externally somehow. That function should
>> only be called if attach is successful.
>>
>> Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
> I'm embarrassed :(  good find! Not sure why you made such an obvious
> bug fix an RFC though! 
> 
> Slight issue in the new error handling though I think..
> 
>> +
>> +out_put_irq:
>> +	iio_trigger_put_irq(trig, pf->irq);
>> +	free_irq(pf->irq, pf);
>> +out_put_module:
> I think the iio_trigger_put_irq should be here as it will have been gotten before the 
> request_threaded_irq call and hence should always be unwound on error not just in the
> case above.
>
Yes. I sent V2 which should properly handle errors from
iio_trigger_get_irq and request_threaded_irq separately.

-- 
Regards,
Leonard

      reply	other threads:[~2016-05-03 12:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28 16:40 [RFC] iio: Release irq if set_trigger_state fails Crestez Dan Leonard
2016-05-01 19:11 ` Jonathan Cameron
2016-05-03 12:24   ` Crestez Dan Leonard [this message]

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=5728988D.1080502@intel.com \
    --to=leonard.crestez@intel.com \
    --cc=daniel.baluta@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).