From: Andrzej Hajda <a.hajda@samsung.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: linux-kernel@vger.kernel.org,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result
Date: Tue, 10 Nov 2015 07:48:54 +0100 [thread overview]
Message-ID: <56419356.5010603@samsung.com> (raw)
In-Reply-To: <5373820.hJbPzosF9i@avalon>
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)) {
next prev parent reply other threads:[~2015-11-10 6:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1443103227-25612-1-git-send-email-a.hajda@samsung.com>
2015-09-24 14:00 ` [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result Andrzej Hajda
2015-11-09 20:16 ` Laurent Pinchart
2015-11-10 6:48 ` Andrzej Hajda [this message]
2015-11-10 8:53 ` Laurent Pinchart
2015-11-10 9:59 ` Andrzej Hajda
2015-09-24 14:00 ` [PATCH 05/19] media: am437x-vpfe: " Andrzej Hajda
2015-09-24 14:00 ` [PATCH 06/19] staging: media: omap4iss: " Andrzej Hajda
2015-09-24 15:07 ` Dan Carpenter
2015-09-24 14:00 ` [PATCH 10/19] cx231xx: fix handling cx231xx_read_i2c_data result Andrzej Hajda
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=56419356.5010603@samsung.com \
--to=a.hajda@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@osg.samsung.com \
/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).