Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1265985 > unrolled thread
| Started by | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| First post | 2015-11-09 21:20 +0100 |
| Last post | 2015-11-10 11:10 +0100 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2015-11-09 21:20 +0100
Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result Andrzej Hajda <a.hajda@samsung.com> - 2015-11-10 08:00 +0100
Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result Laurent Pinchart <laurent.pinchart@ideasonboard.com> - 2015-11-10 10:00 +0100
Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result Andrzej Hajda <a.hajda@samsung.com> - 2015-11-10 11:10 +0100
| From | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| Date | 2015-11-09 21:20 +0100 |
| Subject | Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result |
| Message-ID | <qt14Z-2JC-9@gated-at.bofh.it> |
Hi Andrzej,
Thank you for the patch.
On Thursday 24 September 2015 16:00:12 Andrzej Hajda wrote:
> The function can return negative value.
>
> The problem has been detected using proposed semantic patch
> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>
> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>
> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> ---
> Hi,
>
> To avoid problems with too many mail recipients I have sent whole
> patchset only to LKML. Anyway patches have no dependencies.
>
> Regards
> Andrzej
> ---
> drivers/media/platform/omap3isp/isp.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/omap3isp/isp.c
> b/drivers/media/platform/omap3isp/isp.c index 56e683b..df9d2c2 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -2442,12 +2442,13 @@ static int isp_probe(struct platform_device *pdev)
> }
>
> /* Interrupt */
> - isp->irq_num = platform_get_irq(pdev, 0);
> - if (isp->irq_num <= 0) {
> + ret = platform_get_irq(pdev, 0);
> + if (ret <= 0) {
Looking at platform_get_irq() all error values are negative. You could just
test for ret < 0 here, and remove the ret = -ENODEV assignment below to keep
the error code returned by platform_get_irq().
If you're fine with that modification there's no need to resubmit, just let me
know and I'll fix it when applying it to my tree.
> dev_err(isp->dev, "No IRQ resource\n");
> ret = -ENODEV;
> goto error_iommu;
> }
> + isp->irq_num = ret;
>
> if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
> "OMAP3 ISP", isp)) {
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| Date | 2015-11-10 08:00 +0100 |
| Message-ID | <qtb4l-1Au-1@gated-at.bofh.it> |
| In reply to | #1265985 |
On 11/09/2015 09:16 PM, Laurent Pinchart wrote:
> Hi Andrzej,
>
> Thank you for the patch.
>
> On Thursday 24 September 2015 16:00:12 Andrzej Hajda wrote:
>> The function can return negative value.
>>
>> The problem has been detected using proposed semantic patch
>> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>>
>> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>>
>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>> ---
>> Hi,
>>
>> To avoid problems with too many mail recipients I have sent whole
>> patchset only to LKML. Anyway patches have no dependencies.
>>
>> Regards
>> Andrzej
>> ---
>> drivers/media/platform/omap3isp/isp.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/omap3isp/isp.c
>> b/drivers/media/platform/omap3isp/isp.c index 56e683b..df9d2c2 100644
>> --- a/drivers/media/platform/omap3isp/isp.c
>> +++ b/drivers/media/platform/omap3isp/isp.c
>> @@ -2442,12 +2442,13 @@ static int isp_probe(struct platform_device *pdev)
>> }
>>
>> /* Interrupt */
>> - isp->irq_num = platform_get_irq(pdev, 0);
>> - if (isp->irq_num <= 0) {
>> + ret = platform_get_irq(pdev, 0);
>> + if (ret <= 0) {
> Looking at platform_get_irq() all error values are negative. You could just
> test for ret < 0 here, and remove the ret = -ENODEV assignment below to keep
> the error code returned by platform_get_irq().
>
> If you're fine with that modification there's no need to resubmit, just let me
> know and I'll fix it when applying it to my tree.
I left it as before, as it was not related to the patch. Additionally I have
lurked little bit inside platform_get_irq and it looks little bit scary to me:
platform_get_irq returns value of of_irq_get if ret >= 0,
of_irq_get calls of_irq_parse_one which can return 0,
in such case irq_create_of_mapping value is returned which is unsigned int
and evaluates to 0 in case of failures.
I am not sure if above scenario can ever occur, but the code looks so messy to me,
that I gave up :)
Anyway if you are sure about your change I am OK with it also :)
Regards
Andrzej
>
>> dev_err(isp->dev, "No IRQ resource\n");
>> ret = -ENODEV;
>> goto error_iommu;
>> }
>> + isp->irq_num = ret;
>>
>> if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
>> "OMAP3 ISP", isp)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
|---|---|
| Date | 2015-11-10 10:00 +0100 |
| Message-ID | <qtcWt-2M4-5@gated-at.bofh.it> |
| In reply to | #1266281 |
Hi Andrzej,
On Tuesday 10 November 2015 07:48:54 Andrzej Hajda wrote:
> On 11/09/2015 09:16 PM, Laurent Pinchart wrote:
> > On Thursday 24 September 2015 16:00:12 Andrzej Hajda wrote:
> >> The function can return negative value.
> >>
> >> The problem has been detected using proposed semantic patch
> >> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
> >>
> >> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
> >>
> >> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
> >> ---
> >> Hi,
> >>
> >> To avoid problems with too many mail recipients I have sent whole
> >> patchset only to LKML. Anyway patches have no dependencies.
> >>
> >> drivers/media/platform/omap3isp/isp.c | 5 +++--
> >> 1 file changed, 3 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/media/platform/omap3isp/isp.c
> >> b/drivers/media/platform/omap3isp/isp.c index 56e683b..df9d2c2 100644
> >> --- a/drivers/media/platform/omap3isp/isp.c
> >> +++ b/drivers/media/platform/omap3isp/isp.c
> >> @@ -2442,12 +2442,13 @@ static int isp_probe(struct platform_device
> >> *pdev)
> >> }
> >>
> >> /* Interrupt */
> >> - isp->irq_num = platform_get_irq(pdev, 0);
> >> - if (isp->irq_num <= 0) {
> >> + ret = platform_get_irq(pdev, 0);
> >> + if (ret <= 0) {
> >
> > Looking at platform_get_irq() all error values are negative. You could
> > just test for ret < 0 here, and remove the ret = -ENODEV assignment below
> > to keep the error code returned by platform_get_irq().
> >
> > If you're fine with that modification there's no need to resubmit, just
> > let me know and I'll fix it when applying it to my tree.
>
> I left it as before, as it was not related to the patch. Additionally I have
> lurked little bit inside platform_get_irq and it looks little bit scary to
> me: platform_get_irq returns value of of_irq_get if ret >= 0,
> of_irq_get calls of_irq_parse_one which can return 0,
> in such case irq_create_of_mapping value is returned which is unsigned int
> and evaluates to 0 in case of failures.
> I am not sure if above scenario can ever occur, but the code looks so messy
> to me, that I gave up :)
>
> Anyway if you are sure about your change I am OK with it also :)
You're right, that's indeed an issue. It looks like a 0 irq is valid or
invalid depending on who you ask. NO_IRQ is defined differently depending on
the architecture :-/ I'll thus keep your version of the patch.
Nonetheless, the core issue should be fixed. Do you feel adventurous ? :-)
> >> dev_err(isp->dev, "No IRQ resource\n");
> >> ret = -ENODEV;
> >> goto error_iommu;
> >>
> >> }
> >>
> >> + isp->irq_num = ret;
> >>
> >> if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
> >>
> >> "OMAP3 ISP", isp)) {
--
Regards,
Laurent Pinchart
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrzej Hajda <a.hajda@samsung.com> |
|---|---|
| Date | 2015-11-10 11:10 +0100 |
| Message-ID | <qte2e-3Ga-35@gated-at.bofh.it> |
| In reply to | #1266334 |
On 11/10/2015 09:53 AM, Laurent Pinchart wrote:
> Hi Andrzej,
>
> On Tuesday 10 November 2015 07:48:54 Andrzej Hajda wrote:
>> On 11/09/2015 09:16 PM, Laurent Pinchart wrote:
>>> On Thursday 24 September 2015 16:00:12 Andrzej Hajda wrote:
>>>> The function can return negative value.
>>>>
>>>> The problem has been detected using proposed semantic patch
>>>> scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
>>>>
>>>> [1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
>>>>
>>>> Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
>>>> ---
>>>> Hi,
>>>>
>>>> To avoid problems with too many mail recipients I have sent whole
>>>> patchset only to LKML. Anyway patches have no dependencies.
>>>>
>>>> drivers/media/platform/omap3isp/isp.c | 5 +++--
>>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/media/platform/omap3isp/isp.c
>>>> b/drivers/media/platform/omap3isp/isp.c index 56e683b..df9d2c2 100644
>>>> --- a/drivers/media/platform/omap3isp/isp.c
>>>> +++ b/drivers/media/platform/omap3isp/isp.c
>>>> @@ -2442,12 +2442,13 @@ static int isp_probe(struct platform_device
>>>> *pdev)
>>>> }
>>>>
>>>> /* Interrupt */
>>>> - isp->irq_num = platform_get_irq(pdev, 0);
>>>> - if (isp->irq_num <= 0) {
>>>> + ret = platform_get_irq(pdev, 0);
>>>> + if (ret <= 0) {
>>> Looking at platform_get_irq() all error values are negative. You could
>>> just test for ret < 0 here, and remove the ret = -ENODEV assignment below
>>> to keep the error code returned by platform_get_irq().
>>>
>>> If you're fine with that modification there's no need to resubmit, just
>>> let me know and I'll fix it when applying it to my tree.
>> I left it as before, as it was not related to the patch. Additionally I have
>> lurked little bit inside platform_get_irq and it looks little bit scary to
>> me: platform_get_irq returns value of of_irq_get if ret >= 0,
>> of_irq_get calls of_irq_parse_one which can return 0,
>> in such case irq_create_of_mapping value is returned which is unsigned int
>> and evaluates to 0 in case of failures.
>> I am not sure if above scenario can ever occur, but the code looks so messy
>> to me, that I gave up :)
>>
>> Anyway if you are sure about your change I am OK with it also :)
> You're right, that's indeed an issue. It looks like a 0 irq is valid or
> invalid depending on who you ask. NO_IRQ is defined differently depending on
> the architecture :-/ I'll thus keep your version of the patch.
>
> Nonetheless, the core issue should be fixed. Do you feel adventurous ? :-)
Currently I am busy with other tasks, so I will be happy if somebody will
take care of it :), if not I will return to it if time permits.
Regards
Andrzej
>
>>>> dev_err(isp->dev, "No IRQ resource\n");
>>>> ret = -ENODEV;
>>>> goto error_iommu;
>>>>
>>>> }
>>>>
>>>> + isp->irq_num = ret;
>>>>
>>>> if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED,
>>>>
>>>> "OMAP3 ISP", isp)) {
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web