Re: [PATCH 1/2] sbp-target: use simple assignment in tgt_agent_rw_agent_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

On Tue, 2012-12-11 at 21:58 +0000, Chris Boot wrote:
> 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.
> 

Looks good to me.  Applying to for-next now to be included in the v3.8
PULL request.

Thanks!

--nab

> Signed-off-by: Chris Boot <bootc@xxxxxxxxx>
> Cc: Stefan Richter <stefanr@xxxxxxxxxxxxxxxxx>
> Cc: Andy Grover <agrover@xxxxxxxxxx>
> Cc: Clemens Ladisch <clemens@xxxxxxxxxx>
> Cc: Nicholas A. Bellinger <nab@xxxxxxxxxxxxxxx>
> ---
>  drivers/target/sbp/sbp_target.c |    7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/target/sbp/sbp_target.c b/drivers/target/sbp/sbp_target.c
> index 0d6d7c1..f0a2a1d 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;
>  


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux