@@ -1771,6 +1771,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
1771
1771
attr -> dev_attr .show = mlxbf_pmc_event_list_show ;
1772
1772
attr -> nr = blk_num ;
1773
1773
attr -> dev_attr .attr .name = devm_kasprintf (dev , GFP_KERNEL , "event_list" );
1774
+ if (!attr -> dev_attr .attr .name )
1775
+ return - ENOMEM ;
1774
1776
pmc -> block [blk_num ].block_attr [i ] = & attr -> dev_attr .attr ;
1775
1777
attr = NULL ;
1776
1778
@@ -1784,6 +1786,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
1784
1786
attr -> nr = blk_num ;
1785
1787
attr -> dev_attr .attr .name = devm_kasprintf (dev , GFP_KERNEL ,
1786
1788
"enable" );
1789
+ if (!attr -> dev_attr .attr .name )
1790
+ return - ENOMEM ;
1787
1791
pmc -> block [blk_num ].block_attr [++ i ] = & attr -> dev_attr .attr ;
1788
1792
attr = NULL ;
1789
1793
}
@@ -1810,6 +1814,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
1810
1814
attr -> nr = blk_num ;
1811
1815
attr -> dev_attr .attr .name = devm_kasprintf (dev , GFP_KERNEL ,
1812
1816
"counter%d" , j );
1817
+ if (!attr -> dev_attr .attr .name )
1818
+ return - ENOMEM ;
1813
1819
pmc -> block [blk_num ].block_attr [++ i ] = & attr -> dev_attr .attr ;
1814
1820
attr = NULL ;
1815
1821
@@ -1821,6 +1827,8 @@ static int mlxbf_pmc_init_perftype_counter(struct device *dev, int blk_num)
1821
1827
attr -> nr = blk_num ;
1822
1828
attr -> dev_attr .attr .name = devm_kasprintf (dev , GFP_KERNEL ,
1823
1829
"event%d" , j );
1830
+ if (!attr -> dev_attr .attr .name )
1831
+ return - ENOMEM ;
1824
1832
pmc -> block [blk_num ].block_attr [++ i ] = & attr -> dev_attr .attr ;
1825
1833
attr = NULL ;
1826
1834
}
@@ -1853,6 +1861,8 @@ static int mlxbf_pmc_init_perftype_reg(struct device *dev, int blk_num)
1853
1861
attr -> nr = blk_num ;
1854
1862
attr -> dev_attr .attr .name = devm_kasprintf (dev , GFP_KERNEL ,
1855
1863
events [j ].evt_name );
1864
+ if (!attr -> dev_attr .attr .name )
1865
+ return - ENOMEM ;
1856
1866
pmc -> block [blk_num ].block_attr [i ] = & attr -> dev_attr .attr ;
1857
1867
attr = NULL ;
1858
1868
i ++ ;
@@ -1882,6 +1892,8 @@ static int mlxbf_pmc_create_groups(struct device *dev, int blk_num)
1882
1892
pmc -> block [blk_num ].block_attr_grp .attrs = pmc -> block [blk_num ].block_attr ;
1883
1893
pmc -> block [blk_num ].block_attr_grp .name = devm_kasprintf (
1884
1894
dev , GFP_KERNEL , pmc -> block_name [blk_num ]);
1895
+ if (!pmc -> block [blk_num ].block_attr_grp .name )
1896
+ return - ENOMEM ;
1885
1897
pmc -> groups [pmc -> group_num ] = & pmc -> block [blk_num ].block_attr_grp ;
1886
1898
pmc -> group_num ++ ;
1887
1899
0 commit comments