File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 9
9
* Modified: 2004, Oct Szabolcs Gyurko
10
10
*/
11
11
12
+ #include <linux/cleanup.h>
12
13
#include <linux/module.h>
13
14
#include <linux/types.h>
14
15
#include <linux/init.h>
@@ -756,10 +757,10 @@ int power_supply_get_battery_info(struct power_supply *psy,
756
757
757
758
for (index = 0 ; index < len ; index ++ ) {
758
759
struct power_supply_battery_ocv_table * table ;
759
- char * propname ;
760
760
int i , tab_len , size ;
761
761
762
- propname = kasprintf (GFP_KERNEL , "ocv-capacity-table-%d" , index );
762
+ char * propname __free (kfree ) = kasprintf (GFP_KERNEL , "ocv-capacity-table-%d" ,
763
+ index );
763
764
if (!propname ) {
764
765
power_supply_put_battery_info (psy , info );
765
766
err = - ENOMEM ;
@@ -768,13 +769,11 @@ int power_supply_get_battery_info(struct power_supply *psy,
768
769
list = of_get_property (battery_np , propname , & size );
769
770
if (!list || !size ) {
770
771
dev_err (& psy -> dev , "failed to get %s\n" , propname );
771
- kfree (propname );
772
772
power_supply_put_battery_info (psy , info );
773
773
err = - EINVAL ;
774
774
goto out_put_node ;
775
775
}
776
776
777
- kfree (propname );
778
777
tab_len = size / (2 * sizeof (__be32 ));
779
778
info -> ocv_table_size [index ] = tab_len ;
780
779
You can’t perform that action at this time.
0 commit comments