Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751296AbbKJGtT (ORCPT ); Tue, 10 Nov 2015 01:49:19 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:38297 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750765AbbKJGtR (ORCPT ); Tue, 10 Nov 2015 01:49:17 -0500 X-AuditID: cbfec7f4-f79c56d0000012ee-c5-5641936aeff7 Subject: Re: [PATCH 04/19] v4l: omap3isp: fix handling platform_get_irq result To: Laurent Pinchart References: <1443103227-25612-1-git-send-email-a.hajda@samsung.com> <1443103227-25612-5-git-send-email-a.hajda@samsung.com> <5373820.hJbPzosF9i@avalon> Cc: linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Marek Szyprowski , Mauro Carvalho Chehab , linux-media@vger.kernel.org From: Andrzej Hajda Message-id: <56419356.5010603@samsung.com> Date: Tue, 10 Nov 2015 07:48:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-version: 1.0 In-reply-to: <5373820.hJbPzosF9i@avalon> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xK7pZkx3DDLp3sVlsnLGe1aJz4hJ2 i8u75rBZ9GzYymqx9shddovVzyoc2Dxmd8xk9djSf5fdo2/LKkaPz5vkAliiuGxSUnMyy1KL 9O0SuDIu9U1kK/gqVLH85xb2BsZ5/F2MnBwSAiYSs6/dYoKwxSQu3FvP1sXIxSEksJRR4uvU i1DOc0aJqV+msYNUCQv4SUx4uIsFxBYRsJDoXTSdEaJoNqPE2tdNrCAOs8B1Ronec3uYQarY BDQl/m6+yQZi8wpoSdy+swJsEouAqsTXM/vAbFGBCImJExpYIWoEJX5Mvge2gVNAQ+Llvw6g DRxAQ/Uk7l/UAgkzC8hLbF7zlnkCo8AsJB2zEKpmIalawMi8ilE0tTS5oDgpPddQrzgxt7g0 L10vOT93EyMkoL/sYFx8zOoQowAHoxIP74RvDmFCrIllxZW5hxglOJiVRHjtXwCFeFMSK6tS i/Lji0pzUosPMUpzsCiJ887d9T5ESCA9sSQ1OzW1ILUIJsvEwSnVwBgmu8vyr0rpmS7fBp/H Z+WbTK84Ra758vPbZ4Fb57/9COT6Y8bwYupW9gP9Mqv0Wos+cH6yrKtJsznbx9adfmpXPldf xMaHBhVrraqFK5anmC6bnlR2zGmqqHLnJlk/Wfl1uV7PAn/+eWjzaruU6sJDT6Zrp3/IZN73 m/3uDUeD9pqVk2Mj7yuxFGckGmoxFxUnAgAXWzKEZAIAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2597 Lines: 74 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 >> --- >> 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/