* [PATCH] staging: media: atomisp: fix build error
@ 2017-03-23 13:12 Geliang Tang
2017-03-23 13:12 ` [PATCH] staging: media: atomisp: use kvmalloc and kvfree Geliang Tang
2017-03-23 15:59 ` [PATCH] staging: media: atomisp: fix build error Alan Cox
0 siblings, 2 replies; 4+ messages in thread
From: Geliang Tang @ 2017-03-23 13:12 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Greg Kroah-Hartman, Alan Cox,
Jérémy Lefaure, Varsha Rao
Cc: Geliang Tang, linux-media, devel, linux-kernel
Fix the following build error:
CC drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.o
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c:52:2:
error: excess elements in array initializer [-Werror]
"i", /* ion */
^~~
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c:52:2:
note: (near initialization for ‘hmm_bo_type_strings’)
cc1: all warnings being treated as errors
scripts/Makefile.build:294: recipe for target
'drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.o' failed
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index a362b49..e78f02f 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -49,7 +49,9 @@ const char *hmm_bo_type_strings[HMM_BO_LAST] = {
"p", /* private */
"s", /* shared */
"u", /* user */
+#ifdef CONFIG_ION
"i", /* ion */
+#endif
};
static ssize_t bo_show(struct device *dev, struct device_attribute *attr,
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: media: atomisp: use kvmalloc and kvfree
2017-03-23 13:12 [PATCH] staging: media: atomisp: fix build error Geliang Tang
@ 2017-03-23 13:12 ` Geliang Tang
2017-03-23 13:37 ` Greg Kroah-Hartman
2017-03-23 15:59 ` [PATCH] staging: media: atomisp: fix build error Alan Cox
1 sibling, 1 reply; 4+ messages in thread
From: Geliang Tang @ 2017-03-23 13:12 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Greg Kroah-Hartman, Daeseok Youn,
Alan Cox, Dan Carpenter, simran singhal
Cc: Geliang Tang, linux-media, devel, linux-kernel
Use kvmalloc() and kvfree() instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 94bc793..c7b9320 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -90,10 +90,7 @@ union host {
void *atomisp_kernel_malloc(size_t bytes)
{
/* vmalloc() is preferable if allocating more than 1 page */
- if (bytes > PAGE_SIZE)
- return vmalloc(bytes);
-
- return kmalloc(bytes, GFP_KERNEL);
+ return kvmalloc(bytes, GFP_KERNEL);
}
/*
@@ -118,10 +115,7 @@ void *atomisp_kernel_zalloc(size_t bytes, bool zero_mem)
void atomisp_kernel_free(void *ptr)
{
/* Verify if buffer was allocated by vmalloc() or kmalloc() */
- if (is_vmalloc_addr(ptr))
- vfree(ptr);
- else
- kfree(ptr);
+ kvfree(ptr);
}
/*
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: media: atomisp: use kvmalloc and kvfree
2017-03-23 13:12 ` [PATCH] staging: media: atomisp: use kvmalloc and kvfree Geliang Tang
@ 2017-03-23 13:37 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2017-03-23 13:37 UTC (permalink / raw)
To: Geliang Tang
Cc: Mauro Carvalho Chehab, Daeseok Youn, Alan Cox, Dan Carpenter,
simran singhal, devel, linux-kernel, linux-media
On Thu, Mar 23, 2017 at 09:12:39PM +0800, Geliang Tang wrote:
> Use kvmalloc() and kvfree() instead of open-coding.
These functions are not in Linus's tree, so I can't apply this patch
without breaking things :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: media: atomisp: fix build error
2017-03-23 13:12 [PATCH] staging: media: atomisp: fix build error Geliang Tang
2017-03-23 13:12 ` [PATCH] staging: media: atomisp: use kvmalloc and kvfree Geliang Tang
@ 2017-03-23 15:59 ` Alan Cox
1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2017-03-23 15:59 UTC (permalink / raw)
To: Geliang Tang, Mauro Carvalho Chehab, Greg Kroah-Hartman,
Jérémy Lefaure, Varsha Rao
Cc: linux-media, devel, linux-kernel
On Thu, 2017-03-23 at 21:12 +0800, Geliang Tang wrote:
> Fix the following build error:
>
> CC drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.o
> drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c:52:2:
> error: excess elements in array initializer [-Werror]
> "i", /* ion */
> ^~~
NAK
I've sent a patch to sort this out properly we shouldn't be using
string arrays for single char values to start with...
Alan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-23 16:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 13:12 [PATCH] staging: media: atomisp: fix build error Geliang Tang
2017-03-23 13:12 ` [PATCH] staging: media: atomisp: use kvmalloc and kvfree Geliang Tang
2017-03-23 13:37 ` Greg Kroah-Hartman
2017-03-23 15:59 ` [PATCH] staging: media: atomisp: fix build error Alan Cox
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).