mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mips:sgi-ip22:Check return value from kzalloc
@ 2018-07-17 11:41 RAGHU Halharvi
  2018-07-31  1:27 ` Paul Burton
  0 siblings, 1 reply; 2+ messages in thread
From: RAGHU Halharvi @ 2018-07-17 11:41 UTC (permalink / raw)
  To: linux-mips, linux-kernel; +Cc: RAGHU Halharvi, jhogan, ralf

Signed-off-by: RAGHU Halharvi <raghuhack78@gmail.com>
---
 arch/mips/sgi-ip22/ip22-gio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index b225033aade6..5aaf40a1743b 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
 		printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
 		       slotno, name, id);
 		gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
+		if (!gio_dev)
+			return -ENOMEM;
 		gio_dev->name = name;
 		gio_dev->slotno = slotno;
 		gio_dev->id.id = id;
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mips:sgi-ip22:Check return value from kzalloc
  2018-07-17 11:41 [PATCH] mips:sgi-ip22:Check return value from kzalloc RAGHU Halharvi
@ 2018-07-31  1:27 ` Paul Burton
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Burton @ 2018-07-31  1:27 UTC (permalink / raw)
  To: RAGHU Halharvi; +Cc: linux-mips, linux-kernel, jhogan, ralf

Hi Raghu,

On Tue, Jul 17, 2018 at 05:11:45PM +0530, RAGHU Halharvi wrote:
> Signed-off-by: RAGHU Halharvi <raghuhack78@gmail.com>
> ---
>  arch/mips/sgi-ip22/ip22-gio.c | 2 ++
>  1 file changed, 2 insertions(+)

You should write a commit message, even for trivial patches, which
describes the motivation for the patch. For more complex patches it
should also explain how the changes being made solve a problem, or
clarify anything non-obvious about the way the patched code works.

In general, read Documentation/process/submitting-patches.rst

> diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
> index b225033aade6..5aaf40a1743b 100644
> --- a/arch/mips/sgi-ip22/ip22-gio.c
> +++ b/arch/mips/sgi-ip22/ip22-gio.c
> @@ -363,6 +363,8 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
>  		printk(KERN_INFO "GIO: slot %d : %s (id %x)\n",
>  		       slotno, name, id);
>  		gio_dev = kzalloc(sizeof *gio_dev, GFP_KERNEL);
> +		if (!gio_dev)
> +			return -ENOMEM;

One especially important point for patches like this one is to make sure
that your code at least compiles. In this case you try to return an
error code from a function that returns void, which won't work.

Thanks,
    Paul

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-07-31  1:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-17 11:41 [PATCH] mips:sgi-ip22:Check return value from kzalloc RAGHU Halharvi
2018-07-31  1:27 ` Paul Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®