diff options
Diffstat (limited to 'net/ipv4/ipmr.c')
-rw-r--r-- | net/ipv4/ipmr.c | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index b8b4b497fb57..37bb497d92af 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1714,26 +1714,8 @@ static const struct seq_operations ipmr_vif_seq_ops = { | |||
1714 | 1714 | ||
1715 | static int ipmr_vif_open(struct inode *inode, struct file *file) | 1715 | static int ipmr_vif_open(struct inode *inode, struct file *file) |
1716 | { | 1716 | { |
1717 | struct seq_file *seq; | 1717 | return seq_open_private(file, &ipmr_vif_seq_ops, |
1718 | int rc = -ENOMEM; | 1718 | sizeof(struct ipmr_vif_iter)); |
1719 | struct ipmr_vif_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); | ||
1720 | |||
1721 | if (!s) | ||
1722 | goto out; | ||
1723 | |||
1724 | rc = seq_open(file, &ipmr_vif_seq_ops); | ||
1725 | if (rc) | ||
1726 | goto out_kfree; | ||
1727 | |||
1728 | s->ct = 0; | ||
1729 | seq = file->private_data; | ||
1730 | seq->private = s; | ||
1731 | out: | ||
1732 | return rc; | ||
1733 | out_kfree: | ||
1734 | kfree(s); | ||
1735 | goto out; | ||
1736 | |||
1737 | } | 1719 | } |
1738 | 1720 | ||
1739 | static const struct file_operations ipmr_vif_fops = { | 1721 | static const struct file_operations ipmr_vif_fops = { |
@@ -1877,25 +1859,8 @@ static const struct seq_operations ipmr_mfc_seq_ops = { | |||
1877 | 1859 | ||
1878 | static int ipmr_mfc_open(struct inode *inode, struct file *file) | 1860 | static int ipmr_mfc_open(struct inode *inode, struct file *file) |
1879 | { | 1861 | { |
1880 | struct seq_file *seq; | 1862 | return seq_open_private(file, &ipmr_mfc_seq_ops, |
1881 | int rc = -ENOMEM; | 1863 | sizeof(struct ipmr_mfc_iter)); |
1882 | struct ipmr_mfc_iter *s = kmalloc(sizeof(*s), GFP_KERNEL); | ||
1883 | |||
1884 | if (!s) | ||
1885 | goto out; | ||
1886 | |||
1887 | rc = seq_open(file, &ipmr_mfc_seq_ops); | ||
1888 | if (rc) | ||
1889 | goto out_kfree; | ||
1890 | |||
1891 | seq = file->private_data; | ||
1892 | seq->private = s; | ||
1893 | out: | ||
1894 | return rc; | ||
1895 | out_kfree: | ||
1896 | kfree(s); | ||
1897 | goto out; | ||
1898 | |||
1899 | } | 1864 | } |
1900 | 1865 | ||
1901 | static const struct file_operations ipmr_mfc_fops = { | 1866 | static const struct file_operations ipmr_mfc_fops = { |