* [PATCH] shmem: fix build regression
@ 2013-02-28 23:17 Wolfram Sang
2013-03-01 0:31 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2013-02-28 23:17 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-mm, Wolfram Sang, Al Viro
commit 6b4d0b27 (clean shmem_file_setup() a bit) broke allnoconfig since
this needs the NOMMU path where 'error' is still needed:
mm/shmem.c:2935:2: error: 'error' undeclared (first use in this function)
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
---
mm/shmem.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/shmem.c b/mm/shmem.c
index ed2befb..56ff7d7 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -2897,6 +2897,7 @@ static struct dentry_operations anon_ops = {
*/
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
{
+ int error;
struct file *res;
struct inode *inode;
struct path path;
--
1.7.10.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] shmem: fix build regression
2013-02-28 23:17 [PATCH] shmem: fix build regression Wolfram Sang
@ 2013-03-01 0:31 ` Andrew Morton
2013-03-01 0:37 ` Al Viro
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2013-03-01 0:31 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-kernel, linux-mm, Al Viro
On Fri, 1 Mar 2013 00:17:39 +0100
Wolfram Sang <wsa@the-dreams.de> wrote:
> commit 6b4d0b27 (clean shmem_file_setup() a bit) broke allnoconfig since
> this needs the NOMMU path where 'error' is still needed:
>
> mm/shmem.c:2935:2: error: 'error' undeclared (first use in this function)
>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> ---
> mm/shmem.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index ed2befb..56ff7d7 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2897,6 +2897,7 @@ static struct dentry_operations anon_ops = {
> */
> struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
> {
> + int error;
> struct file *res;
> struct inode *inode;
> struct path path;
That will generate an unused-var warning on CONFIG_MMU=y. We can
avoid that by doing
+ {
+ int error;
...
+ }
or by reusing an existing local.
How's this?
From: Andrew Morton <akpm@linux-foundation.org>
Subject: shmem-fix-build-regression-fix
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/ramfs.h | 8 +++++++-
mm/shmem.c | 12 ++++--------
2 files changed, 11 insertions(+), 9 deletions(-)
diff -puN mm/shmem.c~shmem-fix-build-regression-fix mm/shmem.c
--- a/mm/shmem.c~shmem-fix-build-regression-fix
+++ a/mm/shmem.c
@@ -25,6 +25,7 @@
#include <linux/init.h>
#include <linux/vfs.h>
#include <linux/mount.h>
+#include <linux/ramfs.h>
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/mm.h>
@@ -2830,8 +2831,6 @@ out4:
* effectively equivalent, but much lighter weight.
*/
-#include <linux/ramfs.h>
-
static struct file_system_type shmem_fs_type = {
.name = "tmpfs",
.mount = ramfs_mount,
@@ -2897,7 +2896,6 @@ static struct dentry_operations anon_ops
*/
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags)
{
- int error;
struct file *res;
struct inode *inode;
struct path path;
@@ -2932,12 +2930,10 @@ struct file *shmem_file_setup(const char
d_instantiate(path.dentry, inode);
inode->i_size = size;
clear_nlink(inode); /* It is unlinked */
-#ifndef CONFIG_MMU
- error = ramfs_nommu_expand_for_mapping(inode, size);
- res = ERR_PTR(error);
- if (error)
+
+ res = ERR_PTR(ramfs_nommu_expand_for_mapping(inode, size));
+ if (IS_ERR(res))
goto put_dentry;
-#endif
res = alloc_file(&path, FMODE_WRITE | FMODE_READ,
&shmem_file_operations);
diff -puN include/linux/ramfs.h~shmem-fix-build-regression-fix include/linux/ramfs.h
--- a/include/linux/ramfs.h~shmem-fix-build-regression-fix
+++ a/include/linux/ramfs.h
@@ -6,7 +6,13 @@ struct inode *ramfs_get_inode(struct sup
extern struct dentry *ramfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data);
-#ifndef CONFIG_MMU
+#ifdef CONFIG_MMU
+static inline int
+ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
+{
+ return 0;
+}
+#else
extern int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize);
extern unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
unsigned long addr,
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] shmem: fix build regression
2013-03-01 0:31 ` Andrew Morton
@ 2013-03-01 0:37 ` Al Viro
0 siblings, 0 replies; 3+ messages in thread
From: Al Viro @ 2013-03-01 0:37 UTC (permalink / raw)
To: Andrew Morton; +Cc: Wolfram Sang, linux-kernel, linux-mm
On Thu, Feb 28, 2013 at 04:31:11PM -0800, Andrew Morton wrote:
> -#ifndef CONFIG_MMU
> - error = ramfs_nommu_expand_for_mapping(inode, size);
> - res = ERR_PTR(error);
> - if (error)
> +
> + res = ERR_PTR(ramfs_nommu_expand_for_mapping(inode, size));
> + if (IS_ERR(res))
> goto put_dentry;
My variant of fix leaves #ifndef in place and makes the check if (res) goto...
I'm not opposed to killing the ifndef, but I think it should be a separate
patch.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-01 0:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-28 23:17 [PATCH] shmem: fix build regression Wolfram Sang
2013-03-01 0:31 ` Andrew Morton
2013-03-01 0:37 ` Al Viro
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).