@@ -367,16 +367,14 @@ static int __devinit max8660_probe(struct i2c_client *client,
367367
368368 if (pdata -> num_subdevs > MAX8660_V_END ) {
369369 dev_err (& client -> dev , "Too many regulators found!\n" );
370- goto out ;
370+ return - EINVAL ;
371371 }
372372
373373 max8660 = kzalloc (sizeof (struct max8660 ) +
374374 sizeof (struct regulator_dev * ) * MAX8660_V_END ,
375375 GFP_KERNEL );
376- if (!max8660 ) {
377- ret = - ENOMEM ;
378- goto out ;
379- }
376+ if (!max8660 )
377+ return - ENOMEM ;
380378
381379 max8660 -> client = client ;
382380 rdev = max8660 -> rdev ;
@@ -405,7 +403,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
405403 for (i = 0 ; i < pdata -> num_subdevs ; i ++ ) {
406404
407405 if (!pdata -> subdevs [i ].platform_data )
408- goto err_free ;
406+ goto err_out ;
409407
410408 boot_on = pdata -> subdevs [i ].platform_data -> constraints .boot_on ;
411409
@@ -431,7 +429,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
431429 case MAX8660_V7 :
432430 if (!strcmp (i2c_id -> name , "max8661" )) {
433431 dev_err (& client -> dev , "Regulator not on this chip!\n" );
434- goto err_free ;
432+ goto err_out ;
435433 }
436434
437435 if (boot_on )
@@ -441,7 +439,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
441439 default :
442440 dev_err (& client -> dev , "invalid regulator %s\n" ,
443441 pdata -> subdevs [i ].name );
444- goto err_free ;
442+ goto err_out ;
445443 }
446444 }
447445
@@ -469,9 +467,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
469467err_unregister :
470468 while (-- i >= 0 )
471469 regulator_unregister (rdev [i ]);
472- err_free :
473- kfree (max8660 );
474- out :
470+ err_out :
475471 return ret ;
476472}
477473
@@ -483,8 +479,6 @@ static int __devexit max8660_remove(struct i2c_client *client)
483479 for (i = 0 ; i < MAX8660_V_END ; i ++ )
484480 if (max8660 -> rdev [i ])
485481 regulator_unregister (max8660 -> rdev [i ]);
486- kfree (max8660 );
487-
488482 return 0 ;
489483}
490484
0 commit comments