From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Markus Elfring <Markus.Elfring@web.de>, Thomas Gleixner <tglx@linutronix.de>, Jason Cooper <jason@lakedaemon.net>, Marc Zyngier <maz@kernel.org>, Guo Ren <guoren@kernel.org>, linux-csky@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v4 02/14] irqchip/csky-apb-intc: Fix potential resource leaks Date: Thu, 2 Jul 2020 19:53:47 +0800 [thread overview] Message-ID: <c0093731-fa42-9d43-ebfc-208ba51a96c5@loongson.cn> (raw) In-Reply-To: <0726ddc2-6b01-2ac8-d5bf-74c3df36b6ef@loongson.cn> On 07/02/2020 04:05 PM, Tiezhu Yang wrote: > On 07/02/2020 03:19 PM, Markus Elfring wrote: >>>>> +++ b/drivers/irqchip/irq-csky-apb-intc.c >> … >>>> I suggest to recheck the parameter alignment for such a function call. >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=7c30b859a947535f2213277e827d7ac7dcff9c84#n93 >>>> >>> OK, thank you, like this: >>> >>> - ret = irq_alloc_domain_generic_chips(root_domain, 32, 1, >>> - "csky_intc", handle_level_irq, >>> - IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, >>> 0, 0); >>> - if (ret) { >>> + if (irq_alloc_domain_generic_chips(root_domain, 32, 1, >>> + "csky_intc", >>> handle_level_irq, >>> + IRQ_NOREQUEST | >>> IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0)) { >>> pr_err("C-SKY Intc irq_alloc_gc failed.\n"); >> … >> >> Would you like to use also horizontal tab characters for the >> corresponding indentation? > > Sorry, I do not quite understanding what you mean, maybe like this? > > if (irq_alloc_domain_generic_chips(root_domain, 32, 1, > "csky_intc", handle_level_irq, > IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0)) { > pr_err("C-SKY Intc irq_alloc_gc failed.\n"); > goto err_domain_remove; > } > Hi Markus, Thank you very much for your review and suggestion. Maybe still use "ret" variable is better, the following is another comment which is only sent to me: [I think that if one of the return values comes from a function call, then you should use the value from the function call even if it is currently always -ENOMEM. The return value of the function call could perhaps change in the future. In any case, ret = foo(); if (ret) is very common in kernel code, and there is no reason not to do it, especially when the function call takes up a lot of space.] Let us keep it as it is to make the code clear and to avoid the alignment issue: ret = foo(); if (ret) { ret = -ENOMEM; goto ... } Thanks, Tiezhu >> >> Regards, >> Markus >
WARNING: multiple messages have this Message-ID (diff)
From: Tiezhu Yang <yangtiezhu@loongson.cn> To: Markus Elfring <Markus.Elfring@web.de>, Thomas Gleixner <tglx@linutronix.de>, Jason Cooper <jason@lakedaemon.net>, Marc Zyngier <maz@kernel.org>, Guo Ren <guoren@kernel.org>, linux-csky@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v4 02/14] irqchip/csky-apb-intc: Fix potential resource leaks Date: Thu, 02 Jul 2020 11:53:47 +0000 [thread overview] Message-ID: <c0093731-fa42-9d43-ebfc-208ba51a96c5@loongson.cn> (raw) In-Reply-To: <0726ddc2-6b01-2ac8-d5bf-74c3df36b6ef@loongson.cn> On 07/02/2020 04:05 PM, Tiezhu Yang wrote: > On 07/02/2020 03:19 PM, Markus Elfring wrote: >>>>> +++ b/drivers/irqchip/irq-csky-apb-intc.c >> … >>>> I suggest to recheck the parameter alignment for such a function call. >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id|30b859a947535f2213277e827d7ac7dcff9c84#n93 >>>> >>> OK, thank you, like this: >>> >>> - ret = irq_alloc_domain_generic_chips(root_domain, 32, 1, >>> - "csky_intc", handle_level_irq, >>> - IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, >>> 0, 0); >>> - if (ret) { >>> + if (irq_alloc_domain_generic_chips(root_domain, 32, 1, >>> + "csky_intc", >>> handle_level_irq, >>> + IRQ_NOREQUEST | >>> IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0)) { >>> pr_err("C-SKY Intc irq_alloc_gc failed.\n"); >> … >> >> Would you like to use also horizontal tab characters for the >> corresponding indentation? > > Sorry, I do not quite understanding what you mean, maybe like this? > > if (irq_alloc_domain_generic_chips(root_domain, 32, 1, > "csky_intc", handle_level_irq, > IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN, 0, 0)) { > pr_err("C-SKY Intc irq_alloc_gc failed.\n"); > goto err_domain_remove; > } > Hi Markus, Thank you very much for your review and suggestion. Maybe still use "ret" variable is better, the following is another comment which is only sent to me: [I think that if one of the return values comes from a function call, then you should use the value from the function call even if it is currently always -ENOMEM. The return value of the function call could perhaps change in the future. In any case, ret = foo(); if (ret) is very common in kernel code, and there is no reason not to do it, especially when the function call takes up a lot of space.] Let us keep it as it is to make the code clear and to avoid the alignment issue: ret = foo(); if (ret) { ret = -ENOMEM; goto ... } Thanks, Tiezhu >> >> Regards, >> Markus >
next prev parent reply other threads:[~2020-07-02 11:54 UTC|newest] Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-01 2:16 [PATCH v4 00/14] irqchip: Fix potential resource leaks Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 01/14] irqchip/ath79-misc: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 02/14] irqchip/csky-apb-intc: " Tiezhu Yang 2020-07-01 8:40 ` Markus Elfring 2020-07-01 8:40 ` Markus Elfring 2020-07-01 9:35 ` Tiezhu Yang 2020-07-01 9:35 ` Tiezhu Yang 2020-07-01 13:04 ` Markus Elfring 2020-07-01 13:04 ` Markus Elfring 2020-07-02 1:18 ` Tiezhu Yang 2020-07-02 1:18 ` Tiezhu Yang 2020-07-02 7:19 ` Markus Elfring 2020-07-02 7:19 ` Markus Elfring 2020-07-02 7:19 ` Markus Elfring 2020-07-02 7:19 ` Markus Elfring 2020-07-02 8:05 ` Tiezhu Yang 2020-07-02 8:05 ` Tiezhu Yang 2020-07-02 11:53 ` Tiezhu Yang [this message] 2020-07-02 11:53 ` Tiezhu Yang 2020-07-02 12:24 ` [v4 " Markus Elfring 2020-07-02 12:24 ` Markus Elfring 2020-07-02 12:35 ` Tiezhu Yang 2020-07-02 12:35 ` Tiezhu Yang 2020-07-02 15:00 ` [PATCH v4 " Dan Carpenter 2020-07-02 15:00 ` Dan Carpenter 2020-07-01 2:16 ` [PATCH v4 03/14] irqchip/csky-mpintc: " Tiezhu Yang 2020-07-01 7:49 ` Markus Elfring 2020-07-01 7:49 ` Markus Elfring 2020-07-01 9:23 ` Tiezhu Yang 2020-07-01 9:23 ` Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 04/14] irqchip/davinci-aintc: " Tiezhu Yang 2020-07-01 8:15 ` Markus Elfring 2020-07-01 8:15 ` Markus Elfring 2020-07-01 9:19 ` Tiezhu Yang 2020-07-01 9:19 ` Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 05/14] irqchip/davinci-cp-intc: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 06/14] irqchip/digicolor: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 07/14] irqchip/dw-apb-ictl: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 08/14] irqchip/ls1x: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 09/14] irqchip/mscc-ocelot: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 10/14] irqchip/nvic: " Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 11/14] irqchip/omap-intc: Fix potential resource leak Tiezhu Yang 2020-07-01 9:14 ` Markus Elfring 2020-07-01 9:14 ` Markus Elfring 2020-07-01 9:40 ` Tiezhu Yang 2020-07-01 9:40 ` Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 12/14] irqchip/riscv-intc: " Tiezhu Yang 2020-07-01 9:30 ` Markus Elfring 2020-07-01 9:30 ` Markus Elfring 2020-07-01 9:30 ` Markus Elfring 2020-07-01 9:43 ` Anup Patel 2020-07-01 2:16 ` [PATCH v4 13/14] irqchip/s3c24xx: Fix potential resource leaks Tiezhu Yang 2020-07-01 2:16 ` [PATCH v4 14/14] irqchip/xilinx-intc: Fix potential resource leak Tiezhu Yang 2020-07-01 9:42 ` Markus Elfring 2020-07-01 9:42 ` Markus Elfring 2020-07-01 9:42 ` Markus Elfring 2020-07-01 9:58 ` Tiezhu Yang 2020-07-01 9:58 ` Tiezhu Yang 2020-07-01 9:58 ` Tiezhu Yang
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=c0093731-fa42-9d43-ebfc-208ba51a96c5@loongson.cn \ --to=yangtiezhu@loongson.cn \ --cc=Markus.Elfring@web.de \ --cc=guoren@kernel.org \ --cc=jason@lakedaemon.net \ --cc=kernel-janitors@vger.kernel.org \ --cc=linux-csky@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=maz@kernel.org \ --cc=tglx@linutronix.de \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.