On Sat, Jul 19, 2014 at 09:34:56PM +0200, Riccardo Lucchese wrote:
> It is silly to go through an if statement to set a single boolean
> value in function of a single boolean expression. In the function
> lov_check_set, assign the return value directly.
> 
> Signed-off-by: Riccardo Lucchese <riccardo.lucch...@gmail.com>
> ---
>  drivers/staging/lustre/lustre/lov/lov_request.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
> b/drivers/staging/lustre/lustre/lov/lov_request.c
> index ce830e4..90fc66a 100644
> --- a/drivers/staging/lustre/lustre/lov/lov_request.c
> +++ b/drivers/staging/lustre/lustre/lov/lov_request.c
> @@ -140,14 +140,13 @@ void lov_set_add_req(struct lov_request *req, struct 
> lov_request_set *set)
>  
>  static int lov_check_set(struct lov_obd *lov, int idx)
>  {
> -     int rc = 0;
> +     int rc;
>       mutex_lock(&lov->lov_lock);
>  
> -     if (lov->lov_tgts[idx] == NULL ||
> -         lov->lov_tgts[idx]->ltd_active ||
> -         (lov->lov_tgts[idx]->ltd_exp != NULL &&
> -          class_exp2cliimp(lov->lov_tgts[idx]->ltd_exp)->imp_connect_tried))
> -             rc = 1;
> +     rc = lov->lov_tgts[idx] == NULL ||
> +             lov->lov_tgts[idx]->ltd_active ||
> +             (lov->lov_tgts[idx]->ltd_exp != NULL &&
> +              
> class_exp2cliimp(lov->lov_tgts[idx]->ltd_exp)->imp_connect_tried);

I don't see how this makes the code more readable at all.

regards,
dan carpenter

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to