Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 37419d67 authored by Chris Boot's avatar Chris Boot Committed by Nicholas Bellinger
Browse files

sbp-target: use simple assignment in tgt_agent_rw_agent_state()



There is no need to memcpy() a 32-bit integer. The data pointer is
guaranteed to be quadlet aligned by the FireWire stack so we can replace
the memcpy() with an assignment.

Thanks to Stefan Richter.

Signed-off-by: default avatarChris Boot <bootc@bootc.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Andy Grover <agrover@redhat.com>
Cc: Clemens Ladisch <clemens@ladisch.de>
Cc: Nicholas A. Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent ed72a4d5
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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;