diff options
author | Ian Kent <raven@themaw.net> | 2016-03-15 17:58:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-15 19:55:16 -0400 |
commit | aa330ddc5393acd32b227918650536070e3a9e54 (patch) | |
tree | 28e364a607766bc48794f91657deaf65b497c565 /fs | |
parent | e9a7c2f1a548f34bcaa7640094201e8b29247940 (diff) |
autofs4: fix coding style problem in autofs4_get_set_timeout()
Refactor autofs4_get_set_timeout() to eliminate coding style error.
Signed-off-by: Ian Kent <raven@themaw.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/autofs4/root.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c index bdeb8838a901..101879ed764c 100644 --- a/fs/autofs4/root.c +++ b/fs/autofs4/root.c | |||
@@ -774,12 +774,16 @@ static int autofs4_dir_mkdir(struct inode *dir, | |||
774 | static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, | 774 | static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, |
775 | compat_ulong_t __user *p) | 775 | compat_ulong_t __user *p) |
776 | { | 776 | { |
777 | int rv; | ||
778 | unsigned long ntimeout; | 777 | unsigned long ntimeout; |
778 | int rv; | ||
779 | |||
780 | rv = get_user(ntimeout, p); | ||
781 | if (rv) | ||
782 | goto error; | ||
779 | 783 | ||
780 | if ((rv = get_user(ntimeout, p)) || | 784 | rv = put_user(sbi->exp_timeout/HZ, p); |
781 | (rv = put_user(sbi->exp_timeout/HZ, p))) | 785 | if (rv) |
782 | return rv; | 786 | goto error; |
783 | 787 | ||
784 | if (ntimeout > UINT_MAX/HZ) | 788 | if (ntimeout > UINT_MAX/HZ) |
785 | sbi->exp_timeout = 0; | 789 | sbi->exp_timeout = 0; |
@@ -787,18 +791,24 @@ static inline int autofs4_compat_get_set_timeout(struct autofs_sb_info *sbi, | |||
787 | sbi->exp_timeout = ntimeout * HZ; | 791 | sbi->exp_timeout = ntimeout * HZ; |
788 | 792 | ||
789 | return 0; | 793 | return 0; |
794 | error: | ||
795 | return rv; | ||
790 | } | 796 | } |
791 | #endif | 797 | #endif |
792 | 798 | ||
793 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, | 799 | static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, |
794 | unsigned long __user *p) | 800 | unsigned long __user *p) |
795 | { | 801 | { |
796 | int rv; | ||
797 | unsigned long ntimeout; | 802 | unsigned long ntimeout; |
803 | int rv; | ||
804 | |||
805 | rv = get_user(ntimeout, p); | ||
806 | if (rv) | ||
807 | goto error; | ||
798 | 808 | ||
799 | if ((rv = get_user(ntimeout, p)) || | 809 | rv = put_user(sbi->exp_timeout/HZ, p); |
800 | (rv = put_user(sbi->exp_timeout/HZ, p))) | 810 | if (rv) |
801 | return rv; | 811 | goto error; |
802 | 812 | ||
803 | if (ntimeout > ULONG_MAX/HZ) | 813 | if (ntimeout > ULONG_MAX/HZ) |
804 | sbi->exp_timeout = 0; | 814 | sbi->exp_timeout = 0; |
@@ -806,6 +816,8 @@ static inline int autofs4_get_set_timeout(struct autofs_sb_info *sbi, | |||
806 | sbi->exp_timeout = ntimeout * HZ; | 816 | sbi->exp_timeout = ntimeout * HZ; |
807 | 817 | ||
808 | return 0; | 818 | return 0; |
819 | error: | ||
820 | return rv; | ||
809 | } | 821 | } |
810 | 822 | ||
811 | /* Return protocol version */ | 823 | /* Return protocol version */ |