lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 06 Nov 2015 11:09:29 +0100
From:	walter harms <wharms@....de>
To:	SF Markus Elfring <elfring@...rs.sourceforge.net>
CC:	Mauro Carvalho Chehab <mchehab@....samsung.com>,
	Maxime Coquelin <maxime.coquelin@...com>,
	Patrice Chotard <patrice.chotard@...com>,
	Srinivas Kandagatla <srinivas.kandagatla@...il.com>,
	linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org,
	kernel@...inux.com, LKML <linux-kernel@...r.kernel.org>,
	kernel-janitors@...r.kernel.org,
	Julia Lawall <julia.lawall@...6.fr>
Subject: Re: [PATCH 2/2] [media] c8sectpfe: Combine three checks into a single
 if block



Am 05.11.2015 19:50, schrieb SF Markus Elfring:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Thu, 5 Nov 2015 19:23:50 +0100
> 
> The variable "tsin" was checked three times in a loop iteration of the
> c8sectpfe_tuner_unregister_frontend() function.
> This implementation detail could be improved by the combination of the
> involved statements into a single if block so that this variable will be
> checked only once there.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> index 07fd6d9..2dfbe8a 100644
> --- a/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> +++ b/drivers/media/platform/sti/c8sectpfe/c8sectpfe-common.c
> @@ -209,17 +209,18 @@ void c8sectpfe_tuner_unregister_frontend(struct c8sectpfe *c8sectpfe,
>  
>  		tsin = fei->channel_data[n];


if you do "if (!tsin) continue ;"
you can save one indent level

re,
 wh

>  
> -		if (tsin && tsin->frontend) {
> -			dvb_unregister_frontend(tsin->frontend);
> -			dvb_frontend_detach(tsin->frontend);
> -		}
> +		if (tsin) {
> +			if (tsin->frontend) {
> +				dvb_unregister_frontend(tsin->frontend);
> +				dvb_frontend_detach(tsin->frontend);
> +			}
>  
> -		if (tsin)
>  			i2c_put_adapter(tsin->i2c_adapter);
>  
> -		if (tsin && tsin->i2c_client) {
> -			module_put(tsin->i2c_client->dev.driver->owner);
> -			i2c_unregister_device(tsin->i2c_client);
> +			if (tsin->i2c_client) {
> +				module_put(tsin->i2c_client->dev.driver->owner);
> +				i2c_unregister_device(tsin->i2c_client);
> +			}
>  		}
>  	}
>  
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ