diff options
author | Jiri Kosina <jkosina@suse.cz> | 2013-01-29 13:48:30 +0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-01-29 13:48:30 +0400 |
commit | 617677295b53a40d0e54aac4cbbc216ffbc755dd (patch) | |
tree | 51b9e87213243ed5efff252c8e8d8fec4eebc588 /drivers/target/sbp/sbp_target.c | |
parent | 5c8d1b68e01a144813e38795fe6dbe7ebb506131 (diff) | |
parent | 6abb7c25775b7fb2225ad0508236d63ca710e65f (diff) | |
download | linux-617677295b53a40d0e54aac4cbbc216ffbc755dd.tar.xz |
Merge branch 'master' into for-next
Conflicts:
drivers/devfreq/exynos4_bus.c
Sync with Linus' tree to be able to apply patches that are
against newer code (mvneta).
Diffstat (limited to 'drivers/target/sbp/sbp_target.c')
-rw-r--r-- | drivers/target/sbp/sbp_target.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c index be793883413d..6917a9e938e7 100644 --- a/drivers/target/sbp/sbp_target.c +++ b/drivers/target/sbp/sbp_target.c @@ -704,16 +704,17 @@ static void session_maintenance_work(struct work_struct *work) static int tgt_agent_rw_agent_state(struct fw_card *card, int tcode, void *data, struct sbp_target_agent *agent) { - __be32 state; + int state; switch (tcode) { case TCODE_READ_QUADLET_REQUEST: pr_debug("tgt_agent AGENT_STATE READ\n"); spin_lock_bh(&agent->lock); - state = cpu_to_be32(agent->state); + state = agent->state; spin_unlock_bh(&agent->lock); - memcpy(data, &state, sizeof(state)); + + *(__be32 *)data = cpu_to_be32(state); return RCODE_COMPLETE; @@ -2207,20 +2208,23 @@ static struct se_portal_group *sbp_make_tpg( tport->mgt_agt = sbp_management_agent_register(tport); if (IS_ERR(tport->mgt_agt)) { ret = PTR_ERR(tport->mgt_agt); - kfree(tpg); - return ERR_PTR(ret); + goto out_free_tpg; } ret = core_tpg_register(&sbp_fabric_configfs->tf_ops, wwn, &tpg->se_tpg, (void *)tpg, TRANSPORT_TPG_TYPE_NORMAL); - if (ret < 0) { - sbp_management_agent_unregister(tport->mgt_agt); - kfree(tpg); - return ERR_PTR(ret); - } + if (ret < 0) + goto out_unreg_mgt_agt; return &tpg->se_tpg; + +out_unreg_mgt_agt: + sbp_management_agent_unregister(tport->mgt_agt); +out_free_tpg: + tport->tpg = NULL; + kfree(tpg); + return ERR_PTR(ret); } static void sbp_drop_tpg(struct se_portal_group *se_tpg) |