* [PATCH] mm: shmem: make shmem_init return void
@ 2022-03-28 11:27 Miaohe Lin
2022-03-28 14:50 ` Muchun Song
0 siblings, 1 reply; 3+ messages in thread
From: Miaohe Lin @ 2022-03-28 11:27 UTC (permalink / raw)
To: akpm, hughd; +Cc: linux-mm, linux-kernel, linmiaohe
The return value of shmem_init is never used. So we can make it
return void now.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
include/linux/shmem_fs.h | 2 +-
mm/shmem.c | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
index ab51d3cd39bd..3e915cc550bc 100644
--- a/include/linux/shmem_fs.h
+++ b/include/linux/shmem_fs.h
@@ -56,7 +56,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
* Functions in mm/shmem.c called directly from elsewhere:
*/
extern const struct fs_parameter_spec shmem_fs_parameters[];
-extern int shmem_init(void);
+extern void shmem_init(void);
extern int shmem_init_fs_context(struct fs_context *fc);
extern struct file *shmem_file_setup(const char *name,
loff_t size, unsigned long flags);
diff --git a/mm/shmem.c b/mm/shmem.c
index 529c9ad3e926..26e09a022087 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -3879,7 +3879,7 @@ static struct file_system_type shmem_fs_type = {
.fs_flags = FS_USERNS_MOUNT,
};
-int __init shmem_init(void)
+void __init shmem_init(void)
{
int error;
@@ -3904,14 +3904,13 @@ int __init shmem_init(void)
else
shmem_huge = SHMEM_HUGE_NEVER; /* just in case it was patched */
#endif
- return 0;
+ return;
out1:
unregister_filesystem(&shmem_fs_type);
out2:
shmem_destroy_inodecache();
shm_mnt = ERR_PTR(error);
- return error;
}
#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_SYSFS)
@@ -3989,14 +3988,14 @@ static struct file_system_type shmem_fs_type = {
.fs_flags = FS_USERNS_MOUNT,
};
-int __init shmem_init(void)
+void __init shmem_init(void)
{
BUG_ON(register_filesystem(&shmem_fs_type) != 0);
shm_mnt = kern_mount(&shmem_fs_type);
BUG_ON(IS_ERR(shm_mnt));
- return 0;
+ return;
}
int shmem_unuse(unsigned int type)
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: shmem: make shmem_init return void
2022-03-28 11:27 [PATCH] mm: shmem: make shmem_init return void Miaohe Lin
@ 2022-03-28 14:50 ` Muchun Song
2022-03-29 2:12 ` Miaohe Lin
0 siblings, 1 reply; 3+ messages in thread
From: Muchun Song @ 2022-03-28 14:50 UTC (permalink / raw)
To: Miaohe Lin
Cc: Andrew Morton, Hugh Dickins, Linux Memory Management List, LKML
On Mon, Mar 28, 2022 at 7:44 PM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> The return value of shmem_init is never used. So we can make it
> return void now.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
> include/linux/shmem_fs.h | 2 +-
> mm/shmem.c | 9 ++++-----
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
> index ab51d3cd39bd..3e915cc550bc 100644
> --- a/include/linux/shmem_fs.h
> +++ b/include/linux/shmem_fs.h
> @@ -56,7 +56,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
> * Functions in mm/shmem.c called directly from elsewhere:
> */
> extern const struct fs_parameter_spec shmem_fs_parameters[];
> -extern int shmem_init(void);
> +extern void shmem_init(void);
> extern int shmem_init_fs_context(struct fs_context *fc);
> extern struct file *shmem_file_setup(const char *name,
> loff_t size, unsigned long flags);
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 529c9ad3e926..26e09a022087 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -3879,7 +3879,7 @@ static struct file_system_type shmem_fs_type = {
> .fs_flags = FS_USERNS_MOUNT,
> };
>
> -int __init shmem_init(void)
> +void __init shmem_init(void)
> {
> int error;
>
> @@ -3904,14 +3904,13 @@ int __init shmem_init(void)
> else
> shmem_huge = SHMEM_HUGE_NEVER; /* just in case it was patched */
> #endif
> - return 0;
> + return;
>
> out1:
> unregister_filesystem(&shmem_fs_type);
> out2:
> shmem_destroy_inodecache();
> shm_mnt = ERR_PTR(error);
> - return error;
> }
>
> #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_SYSFS)
> @@ -3989,14 +3988,14 @@ static struct file_system_type shmem_fs_type = {
> .fs_flags = FS_USERNS_MOUNT,
> };
>
> -int __init shmem_init(void)
> +void __init shmem_init(void)
> {
> BUG_ON(register_filesystem(&shmem_fs_type) != 0);
>
> shm_mnt = kern_mount(&shmem_fs_type);
> BUG_ON(IS_ERR(shm_mnt));
>
> - return 0;
> + return;
Weird. Using return at the end of a void function.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mm: shmem: make shmem_init return void
2022-03-28 14:50 ` Muchun Song
@ 2022-03-29 2:12 ` Miaohe Lin
0 siblings, 0 replies; 3+ messages in thread
From: Miaohe Lin @ 2022-03-29 2:12 UTC (permalink / raw)
To: Muchun Song, Andrew Morton
Cc: Hugh Dickins, Linux Memory Management List, LKML
On 2022/3/28 22:50, Muchun Song wrote:
> On Mon, Mar 28, 2022 at 7:44 PM Miaohe Lin <linmiaohe@huawei.com> wrote:
>>
>> The return value of shmem_init is never used. So we can make it
>> return void now.
>>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>> include/linux/shmem_fs.h | 2 +-
>> mm/shmem.c | 9 ++++-----
>> 2 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h
>> index ab51d3cd39bd..3e915cc550bc 100644
>> --- a/include/linux/shmem_fs.h
>> +++ b/include/linux/shmem_fs.h
>> @@ -56,7 +56,7 @@ static inline struct shmem_inode_info *SHMEM_I(struct inode *inode)
>> * Functions in mm/shmem.c called directly from elsewhere:
>> */
>> extern const struct fs_parameter_spec shmem_fs_parameters[];
>> -extern int shmem_init(void);
>> +extern void shmem_init(void);
>> extern int shmem_init_fs_context(struct fs_context *fc);
>> extern struct file *shmem_file_setup(const char *name,
>> loff_t size, unsigned long flags);
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 529c9ad3e926..26e09a022087 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -3879,7 +3879,7 @@ static struct file_system_type shmem_fs_type = {
>> .fs_flags = FS_USERNS_MOUNT,
>> };
>>
>> -int __init shmem_init(void)
>> +void __init shmem_init(void)
>> {
>> int error;
>>
>> @@ -3904,14 +3904,13 @@ int __init shmem_init(void)
>> else
>> shmem_huge = SHMEM_HUGE_NEVER; /* just in case it was patched */
>> #endif
>> - return 0;
>> + return;
>>
>> out1:
>> unregister_filesystem(&shmem_fs_type);
>> out2:
>> shmem_destroy_inodecache();
>> shm_mnt = ERR_PTR(error);
>> - return error;
>> }
>>
>> #if defined(CONFIG_TRANSPARENT_HUGEPAGE) && defined(CONFIG_SYSFS)
>> @@ -3989,14 +3988,14 @@ static struct file_system_type shmem_fs_type = {
>> .fs_flags = FS_USERNS_MOUNT,
>> };
>>
>> -int __init shmem_init(void)
>> +void __init shmem_init(void)
>> {
>> BUG_ON(register_filesystem(&shmem_fs_type) != 0);
>>
>> shm_mnt = kern_mount(&shmem_fs_type);
>> BUG_ON(IS_ERR(shm_mnt));
>>
>> - return 0;
>> + return;
>
> Weird. Using return at the end of a void function.
Thanks for review. And thanks Andrew for kindly fixing this. :)
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-03-29 2:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 11:27 [PATCH] mm: shmem: make shmem_init return void Miaohe Lin
2022-03-28 14:50 ` Muchun Song
2022-03-29 2:12 ` Miaohe Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.