Re: [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection

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

 



>> @@ -606,7 +606,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req,
>>  	tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL);
>>  	if (!tmr) {
>>  		target_put_sess_cmd(se_cmd);
>> -		goto err;
>> +		goto do_resp;
>>  	}
> 
> Hmm, I'm not convinced this is an improvement.
> 
> I'd rather rename the new error label to "put_cmd" and get rid of the
> braces in above if statement:
> 
> -	if (!tmr) {
> -		target_put_sess_cmd(se_cmd);
> -		goto err;
> -	}
> +	if (!tmr)
> +		goto put_cmd;
> 
> and then in the error path:
> 
> -err:
> +put_cmd:
> +	target_put_sess_cmd(se_cmd);

I am unsure on the relevance of this function on such a source position.
Would it make sense to move it further down at the end?


> +free_tmr:
> 	kfree(tmr);

How do you think about to skip this function call after a memory
allocation failure?

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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux