From: David Rientjes on
On Mon, 7 Jun 2010, Joe Perches wrote:

> And separate declaration from allocation
> Still no error checking on failure, but it probably doesn't matter.
>
> Signed-off-by: Joe Perches <joe(a)perches.com>
> ---
> arch/cris/arch-v32/mm/intmem.c | 13 +++++--------
> 1 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/arch/cris/arch-v32/mm/intmem.c b/arch/cris/arch-v32/mm/intmem.c
> index 9e8b69c..1b17d92 100644
> --- a/arch/cris/arch-v32/mm/intmem.c
> +++ b/arch/cris/arch-v32/mm/intmem.c
> @@ -33,8 +33,8 @@ static void crisv32_intmem_init(void)
> {
> static int initiated = 0;
> if (!initiated) {
> - struct intmem_allocation* alloc =
> - (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL);
> + struct intmem_allocation* alloc;
> + alloc = kmalloc(sizeof *alloc, GFP_KERNEL);
> INIT_LIST_HEAD(&intmem_allocations);
> intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE,
> MEM_INTMEM_SIZE - RESERVED_SIZE);
> @@ -62,9 +62,8 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
> if (allocation->status == STATUS_FREE &&
> allocation->size >= size + alignment) {
> if (allocation->size > size + alignment) {
> - struct intmem_allocation* alloc =
> - (struct intmem_allocation*)
> - kmalloc(sizeof *alloc, GFP_ATOMIC);
> + struct intmem_allocation* alloc;
> + alloc = kmalloc(sizeof *alloc, GFP_ATOMIC);
> alloc->status = STATUS_FREE;
> alloc->size = allocation->size - size -
> alignment;

Why not fix the checkpatch failures at the same time?

ERROR: "foo* bar" should be "foo *bar"
#26: FILE: arch/cris/arch-v32/mm/intmem.c:36:
+ struct intmem_allocation* alloc;

ERROR: "foo* bar" should be "foo *bar"
#38: FILE: arch/cris/arch-v32/mm/intmem.c:65:
+ struct intmem_allocation* alloc;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Joe Perches on
On Mon, 2010-06-07 at 21:44 -0700, David Rientjes wrote:
> On Mon, 7 Jun 2010, Joe Perches wrote:
> > And separate declaration from allocation
> > Still no error checking on failure, but it probably doesn't matter.
[]
> Why not fix the checkpatch failures at the same time?

I think that's better done in a separate pass.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jesper Nilsson on
On Tue, Jun 08, 2010 at 05:50:33AM +0200, Joe Perches wrote:
> And separate declaration from allocation
> Still no error checking on failure, but it probably doesn't matter.

Acked-by: Jesper Nilsson <jesper.nilsson(a)axis.com>

> Signed-off-by: Joe Perches <joe(a)perches.com>
> ---
> arch/cris/arch-v32/mm/intmem.c | 13 +++++--------
> 1 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/arch/cris/arch-v32/mm/intmem.c b/arch/cris/arch-v32/mm/intmem.c
> index 9e8b69c..1b17d92 100644
> --- a/arch/cris/arch-v32/mm/intmem.c
> +++ b/arch/cris/arch-v32/mm/intmem.c
> @@ -33,8 +33,8 @@ static void crisv32_intmem_init(void)
> {
> static int initiated = 0;
> if (!initiated) {
> - struct intmem_allocation* alloc =
> - (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL);
> + struct intmem_allocation* alloc;
> + alloc = kmalloc(sizeof *alloc, GFP_KERNEL);
> INIT_LIST_HEAD(&intmem_allocations);
> intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE,
> MEM_INTMEM_SIZE - RESERVED_SIZE);
> @@ -62,9 +62,8 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
> if (allocation->status == STATUS_FREE &&
> allocation->size >= size + alignment) {
> if (allocation->size > size + alignment) {
> - struct intmem_allocation* alloc =
> - (struct intmem_allocation*)
> - kmalloc(sizeof *alloc, GFP_ATOMIC);
> + struct intmem_allocation* alloc;
> + alloc = kmalloc(sizeof *alloc, GFP_ATOMIC);
> alloc->status = STATUS_FREE;
> alloc->size = allocation->size - size -
> alignment;
> @@ -74,9 +73,7 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
>
> if (alignment) {
> struct intmem_allocation *tmp;
> - tmp = (struct intmem_allocation *)
> - kmalloc(sizeof *tmp,
> - GFP_ATOMIC);
> + tmp = kmalloc(sizeof *tmp, GFP_ATOMIC);
> tmp->offset = allocation->offset;
> tmp->size = alignment;
> tmp->status = STATUS_FREE;
> --
> 1.7.1.244.gbdc4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo(a)vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
/^JN - Jesper Nilsson
--
Jesper Nilsson -- jesper.nilsson(a)axis.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Jiri Kosina on
On Mon, 14 Jun 2010, Jesper Nilsson wrote:

> On Tue, Jun 08, 2010 at 05:50:33AM +0200, Joe Perches wrote:
> > And separate declaration from allocation
> > Still no error checking on failure, but it probably doesn't matter.
>
> Acked-by: Jesper Nilsson <jesper.nilsson(a)axis.com>

Applied, thanks.

--
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/