mips:sgi-ip22:Check return value from kzalloc
PATCH 1/1 mips:sgi-ip22:Check return value from kzalloc
Signed-off-by RAGHU Halharvi <[email protected]>
--- arch/mips/sgi-ip22/ip22-gio.c | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/sgi-ip22/ip22-gio.c +2 -0
@@ -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;
Signature · 1 line
2.17.1
Hi Raghu,
Quoted 4 lines · RAGHU Halharvi
Signed-off-by RAGHU Halharvi <[email protected]>--- 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
arch/mips/sgi-ip22/ip22-gio.c static void ip22_check_gio(int slotno, unsigned long addr, int irq) · line 367
Quoted 10 lines
arch/mips/sgi-ip22/ip22-gio.c +2
-0@@ -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