aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-11-27 12:54:21 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2012-11-28 01:49:24 -0500
commit13f6a91479b06133eb99f1f43be02608eb867313 (patch)
tree721d72ee5d17995c8697e3dbdab5401ba9025069 /drivers/target
parenta5675c8a8b72efdd09ccd1b0975c4670675775ef (diff)
target/configfs: use kmalloc() instead of kzalloc() for default groups
All elements are assigned even the NULL member at the end so there is no reason to allocate zeroed memory. (nab: Fix up minor apply breakage in for-next) Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c4
-rw-r--r--drivers/target/target_core_configfs.c14
-rw-r--r--drivers/target/target_core_fabric_configfs.c6
3 files changed, 12 insertions, 12 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 7c4243ed9ab8..542641c504a6 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -803,7 +803,7 @@ static struct se_node_acl *lio_target_make_nodeacl(
803 acl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl); 803 acl = container_of(se_nacl, struct iscsi_node_acl, se_node_acl);
804 stats_cg = &se_nacl->acl_fabric_stat_group; 804 stats_cg = &se_nacl->acl_fabric_stat_group;
805 805
806 stats_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 806 stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
807 GFP_KERNEL); 807 GFP_KERNEL);
808 if (!stats_cg->default_groups) { 808 if (!stats_cg->default_groups) {
809 pr_err("Unable to allocate memory for" 809 pr_err("Unable to allocate memory for"
@@ -1268,7 +1268,7 @@ static struct se_wwn *lio_target_call_coreaddtiqn(
1268 */ 1268 */
1269 stats_cg = &tiqn->tiqn_wwn.fabric_stat_group; 1269 stats_cg = &tiqn->tiqn_wwn.fabric_stat_group;
1270 1270
1271 stats_cg->default_groups = kzalloc(sizeof(struct config_group *) * 6, 1271 stats_cg->default_groups = kmalloc(sizeof(struct config_group *) * 6,
1272 GFP_KERNEL); 1272 GFP_KERNEL);
1273 if (!stats_cg->default_groups) { 1273 if (!stats_cg->default_groups) {
1274 pr_err("Unable to allocate memory for" 1274 pr_err("Unable to allocate memory for"
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c
index f6fc258b9d40..4efb61b8d001 100644
--- a/drivers/target/target_core_configfs.c
+++ b/drivers/target/target_core_configfs.c
@@ -2496,7 +2496,7 @@ static struct config_group *target_core_make_subdev(
2496 2496
2497 dev_cg = &dev->dev_group; 2497 dev_cg = &dev->dev_group;
2498 2498
2499 dev_cg->default_groups = kzalloc(sizeof(struct config_group *) * 6, 2499 dev_cg->default_groups = kmalloc(sizeof(struct config_group *) * 6,
2500 GFP_KERNEL); 2500 GFP_KERNEL);
2501 if (!dev_cg->default_groups) 2501 if (!dev_cg->default_groups)
2502 goto out_free_device; 2502 goto out_free_device;
@@ -2528,7 +2528,7 @@ static struct config_group *target_core_make_subdev(
2528 dev->t10_alua.default_tg_pt_gp = tg_pt_gp; 2528 dev->t10_alua.default_tg_pt_gp = tg_pt_gp;
2529 2529
2530 tg_pt_gp_cg = &dev->t10_alua.alua_tg_pt_gps_group; 2530 tg_pt_gp_cg = &dev->t10_alua.alua_tg_pt_gps_group;
2531 tg_pt_gp_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 2531 tg_pt_gp_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
2532 GFP_KERNEL); 2532 GFP_KERNEL);
2533 if (!tg_pt_gp_cg->default_groups) { 2533 if (!tg_pt_gp_cg->default_groups) {
2534 pr_err("Unable to allocate tg_pt_gp_cg->" 2534 pr_err("Unable to allocate tg_pt_gp_cg->"
@@ -2544,7 +2544,7 @@ static struct config_group *target_core_make_subdev(
2544 * Add core/$HBA/$DEV/statistics/ default groups 2544 * Add core/$HBA/$DEV/statistics/ default groups
2545 */ 2545 */
2546 dev_stat_grp = &dev->dev_stat_grps.stat_group; 2546 dev_stat_grp = &dev->dev_stat_grps.stat_group;
2547 dev_stat_grp->default_groups = kzalloc(sizeof(struct config_group *) * 4, 2547 dev_stat_grp->default_groups = kmalloc(sizeof(struct config_group *) * 4,
2548 GFP_KERNEL); 2548 GFP_KERNEL);
2549 if (!dev_stat_grp->default_groups) { 2549 if (!dev_stat_grp->default_groups) {
2550 pr_err("Unable to allocate dev_stat_grp->default_groups\n"); 2550 pr_err("Unable to allocate dev_stat_grp->default_groups\n");
@@ -2829,7 +2829,7 @@ static int __init target_core_init_configfs(void)
2829 * and ALUA Logical Unit Group and Target Port Group infrastructure. 2829 * and ALUA Logical Unit Group and Target Port Group infrastructure.
2830 */ 2830 */
2831 target_cg = &subsys->su_group; 2831 target_cg = &subsys->su_group;
2832 target_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 2832 target_cg->default_groups = kmalloc(sizeof(struct config_group) * 2,
2833 GFP_KERNEL); 2833 GFP_KERNEL);
2834 if (!target_cg->default_groups) { 2834 if (!target_cg->default_groups) {
2835 pr_err("Unable to allocate target_cg->default_groups\n"); 2835 pr_err("Unable to allocate target_cg->default_groups\n");
@@ -2845,7 +2845,7 @@ static int __init target_core_init_configfs(void)
2845 * Create ALUA infrastructure under /sys/kernel/config/target/core/alua/ 2845 * Create ALUA infrastructure under /sys/kernel/config/target/core/alua/
2846 */ 2846 */
2847 hba_cg = &target_core_hbagroup; 2847 hba_cg = &target_core_hbagroup;
2848 hba_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 2848 hba_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
2849 GFP_KERNEL); 2849 GFP_KERNEL);
2850 if (!hba_cg->default_groups) { 2850 if (!hba_cg->default_groups) {
2851 pr_err("Unable to allocate hba_cg->default_groups\n"); 2851 pr_err("Unable to allocate hba_cg->default_groups\n");
@@ -2861,7 +2861,7 @@ static int __init target_core_init_configfs(void)
2861 * groups under /sys/kernel/config/target/core/alua/ 2861 * groups under /sys/kernel/config/target/core/alua/
2862 */ 2862 */
2863 alua_cg = &alua_group; 2863 alua_cg = &alua_group;
2864 alua_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 2864 alua_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
2865 GFP_KERNEL); 2865 GFP_KERNEL);
2866 if (!alua_cg->default_groups) { 2866 if (!alua_cg->default_groups) {
2867 pr_err("Unable to allocate alua_cg->default_groups\n"); 2867 pr_err("Unable to allocate alua_cg->default_groups\n");
@@ -2883,7 +2883,7 @@ static int __init target_core_init_configfs(void)
2883 } 2883 }
2884 2884
2885 lu_gp_cg = &alua_lu_gps_group; 2885 lu_gp_cg = &alua_lu_gps_group;
2886 lu_gp_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 2886 lu_gp_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
2887 GFP_KERNEL); 2887 GFP_KERNEL);
2888 if (!lu_gp_cg->default_groups) { 2888 if (!lu_gp_cg->default_groups) {
2889 pr_err("Unable to allocate lu_gp_cg->default_groups\n"); 2889 pr_err("Unable to allocate lu_gp_cg->default_groups\n");
diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
index efe31a00a7cb..9c6791734ee8 100644
--- a/drivers/target/target_core_fabric_configfs.c
+++ b/drivers/target/target_core_fabric_configfs.c
@@ -357,7 +357,7 @@ static struct config_group *target_fabric_make_mappedlun(
357 } 357 }
358 358
359 lacl_cg = &lacl->se_lun_group; 359 lacl_cg = &lacl->se_lun_group;
360 lacl_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 360 lacl_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
361 GFP_KERNEL); 361 GFP_KERNEL);
362 if (!lacl_cg->default_groups) { 362 if (!lacl_cg->default_groups) {
363 pr_err("Unable to allocate lacl_cg->default_groups\n"); 363 pr_err("Unable to allocate lacl_cg->default_groups\n");
@@ -373,7 +373,7 @@ static struct config_group *target_fabric_make_mappedlun(
373 lacl_cg->default_groups[1] = NULL; 373 lacl_cg->default_groups[1] = NULL;
374 374
375 ml_stat_grp = &lacl->ml_stat_grps.stat_group; 375 ml_stat_grp = &lacl->ml_stat_grps.stat_group;
376 ml_stat_grp->default_groups = kzalloc(sizeof(struct config_group *) * 3, 376 ml_stat_grp->default_groups = kmalloc(sizeof(struct config_group *) * 3,
377 GFP_KERNEL); 377 GFP_KERNEL);
378 if (!ml_stat_grp->default_groups) { 378 if (!ml_stat_grp->default_groups) {
379 pr_err("Unable to allocate ml_stat_grp->default_groups\n"); 379 pr_err("Unable to allocate ml_stat_grp->default_groups\n");
@@ -858,7 +858,7 @@ static struct config_group *target_fabric_make_lun(
858 return ERR_PTR(-EINVAL); 858 return ERR_PTR(-EINVAL);
859 859
860 lun_cg = &lun->lun_group; 860 lun_cg = &lun->lun_group;
861 lun_cg->default_groups = kzalloc(sizeof(struct config_group *) * 2, 861 lun_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2,
862 GFP_KERNEL); 862 GFP_KERNEL);
863 if (!lun_cg->default_groups) { 863 if (!lun_cg->default_groups) {
864 pr_err("Unable to allocate lun_cg->default_groups\n"); 864 pr_err("Unable to allocate lun_cg->default_groups\n");