public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] firmware: read firmware size using i_size_read()
@ 2014-06-12 21:05 Dmitry Kasatkin
  2014-06-13 14:56 ` Ming Lei
  0 siblings, 1 reply; 10+ messages in thread
From: Dmitry Kasatkin @ 2014-06-12 21:05 UTC (permalink / raw)
  To: ming.lei; +Cc: gregkh, linux-kernel, Dmitry Kasatkin

There is no need to read attr because inode structure contains size
of the file. Use i_size_read() instead.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
---
 drivers/base/firmware_class.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index c30df50e..9aaa97b 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -279,26 +279,13 @@ static const char * const fw_path[] = {
 module_param_string(path, fw_path_para, sizeof(fw_path_para), 0644);
 MODULE_PARM_DESC(path, "customized firmware image search path with a higher priority than default path");
 
-/* Don't inline this: 'struct kstat' is biggish */
-static noinline_for_stack int fw_file_size(struct file *file)
-{
-	struct kstat st;
-	if (vfs_getattr(&file->f_path, &st))
-		return -1;
-	if (!S_ISREG(st.mode))
-		return -1;
-	if (st.size != (int)st.size)
-		return -1;
-	return st.size;
-}
-
 static int fw_read_file_contents(struct file *file, struct firmware_buf *fw_buf)
 {
 	int size;
 	char *buf;
 	int rc;
 
-	size = fw_file_size(file);
+	size = i_size_read(file_inode(file));
 	if (size <= 0)
 		return -EINVAL;
 	buf = vmalloc(size);
-- 
1.9.1


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

end of thread, other threads:[~2014-07-08 22:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 21:05 [PATCH 1/1] firmware: read firmware size using i_size_read() Dmitry Kasatkin
2014-06-13 14:56 ` Ming Lei
2014-06-13 15:09   ` [PATCH v2 0/1] " Dmitry Kasatkin
2014-06-13 15:09     ` [PATCH v2 1/1] firmware: " Dmitry Kasatkin
2014-06-13 16:03       ` Ming Lei
2014-06-13 16:06         ` Dmitry Kasatkin
2014-06-25 16:46           ` Dmitry Kasatkin
2014-07-02  1:33             ` Ming Lei
2014-07-02  5:27               ` Greg Kroah-Hartman
2014-07-08 22:26             ` Greg Kroah-Hartman

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