Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2fda16d7 authored by Joe Perches's avatar Joe Perches Committed by Jiri Kosina
Browse files

arch/cris: Remove unnecessary kmalloc casts



And separate declaration from allocation
Still no error checking on failure, but it probably doesn't matter.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarJesper Nilsson <jesper.nilsson@axis.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent c20cbe46
Loading
Loading
Loading
Loading
+5 −8
Original line number Original line Diff line number Diff line
@@ -33,8 +33,8 @@ static void crisv32_intmem_init(void)
{
{
	static int initiated = 0;
	static int initiated = 0;
	if (!initiated) {
	if (!initiated) {
		struct intmem_allocation* alloc =
		struct intmem_allocation* alloc;
		  (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL);
		alloc = kmalloc(sizeof *alloc, GFP_KERNEL);
		INIT_LIST_HEAD(&intmem_allocations);
		INIT_LIST_HEAD(&intmem_allocations);
		intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE,
		intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE,
					 MEM_INTMEM_SIZE - RESERVED_SIZE);
					 MEM_INTMEM_SIZE - RESERVED_SIZE);
@@ -62,9 +62,8 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
		if (allocation->status == STATUS_FREE &&
		if (allocation->status == STATUS_FREE &&
		    allocation->size >= size + alignment) {
		    allocation->size >= size + alignment) {
			if (allocation->size > size + alignment) {
			if (allocation->size > size + alignment) {
				struct intmem_allocation* alloc =
				struct intmem_allocation* alloc;
					(struct intmem_allocation*)
				alloc = kmalloc(sizeof *alloc, GFP_ATOMIC);
					kmalloc(sizeof *alloc, GFP_ATOMIC);
				alloc->status = STATUS_FREE;
				alloc->status = STATUS_FREE;
				alloc->size = allocation->size - size -
				alloc->size = allocation->size - size -
					alignment;
					alignment;
@@ -74,9 +73,7 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)


				if (alignment) {
				if (alignment) {
					struct intmem_allocation *tmp;
					struct intmem_allocation *tmp;
					tmp = (struct intmem_allocation *)
					tmp = kmalloc(sizeof *tmp, GFP_ATOMIC);
						kmalloc(sizeof *tmp,
							GFP_ATOMIC);
					tmp->offset = allocation->offset;
					tmp->offset = allocation->offset;
					tmp->size = alignment;
					tmp->size = alignment;
					tmp->status = STATUS_FREE;
					tmp->status = STATUS_FREE;