Re: [PATCH 8/8] cris-cryptocop: Apply another recommendation from "checkpatch.pl"

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

 




On Fri, 26 Aug 2016, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Fri, 26 Aug 2016 14:23:06 +0200
>
> The script "checkpatch.pl" can point out that assignments should usually
> not be performed within condition checks.
> Thus move the assignments for a local variable to separate statements
> in three functions.
>
> Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> ---
>  arch/cris/arch-v32/drivers/cryptocop.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
> index 1a966dc..00231a7 100644
> --- a/arch/cris/arch-v32/drivers/cryptocop.c
> +++ b/arch/cris/arch-v32/drivers/cryptocop.c
> @@ -1510,7 +1510,8 @@ int cryptocop_new_session(cryptocop_session_id *sid, struct cryptocop_transform_
>  	while (tfrm_in){
>  		int err;
>  		++no_tfrms;
> -		if ((err = transform_ok(tfrm_in))) {
> +		err = transform_ok(tfrm_in);
> +		if (err) {
>  			DEBUG_API(printk("cryptocop_new_session, bad transform\n"));
>  			return err;
>  		}
> @@ -2276,7 +2277,10 @@ static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_
>  		(*pj)->iop->ctx_in.saved_data = operation->list_op.inlist;
>  		(*pj)->iop->ctx_in.saved_data_buf = operation->list_op.in_data_buf;
>  	} else {
> -		if ((err = cryptocop_setup_dma_list(operation, &(*pj)->iop, alloc_flag))) {
> +		err = cryptocop_setup_dma_list(operation,
> +					       &(*pj)->iop,
> +					       alloc_flag);

Checkpatch didn't say to put every argument on a different line, and that
wasn't done before, so why do it now?  There is plenty of room for at
least &(*pj)->iop on the line before.

julia

> +		if (err) {
>  			DEBUG_API(printk("cryptocop_job_setup: cryptocop_setup_dma_list failed %d\n", err));
>  			kfree(*pj);
>  			return err;
> @@ -2867,7 +2871,8 @@ static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsig
>
>  	DEBUG(printk("cryptocop_ioctl_process: inserting job, cb_data=0x%p\n", cop->cb_data));
>
> -	if ((err = cryptocop_job_queue_insert_user_job(cop)) != 0) {
> +	err = cryptocop_job_queue_insert_user_job(cop);
> +	if (err) {
>  		DEBUG_API(printk("cryptocop_ioctl_process: insert job %d\n", err));
>  		err = -EINVAL;
>  		goto mark_outpages_dirty;
> --
> 2.9.3
>
> --
> 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
>
--
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