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] [day] [month] [year] [list]
Date:	Sat, 27 Jul 2013 10:53:20 -0700
From:	Joe Perches <joe@...ches.com>
To:	"santosh.anbu" <asantoshking@...il.com>
Cc:	airlied@...ux.ie, asantosh.king@...il.com,
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] i2c.c: Fixed coding style issue for if statement

On Sat, 2013-07-27 at 23:18 +0530, santosh.anbu wrote:
> From: "santosh.anbu" <asantosh.king@...il.com>
[]
> diff --git a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> index cfb9288..e88529c 100644
> --- a/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> +++ b/drivers/gpu/drm/nouveau/core/subdev/bios/i2c.c
> @@ -114,15 +114,19 @@ dcb_i2c_parse(struct nouveau_bios *bios, u8 idx, struct dcb_i2c_entry *info)
>  
>  		if (idx == 0) {
>  			info->drive = nv_ro08(bios, ent + 4);
> -			if (!info->drive) info->drive = 0x3f;
> +			if (!info->drive)
> +				info->drive = 0x3f;
>  			info->sense = nv_ro08(bios, ent + 5);
> -			if (!info->sense) info->sense = 0x3e;
> +			if (!info->sense)
> +				info->sense = 0x3e;
>  		} else
>  		if (idx == 1) {
>  			info->drive = nv_ro08(bios, ent + 6);
> -			if (!info->drive) info->drive = 0x37;
> +			if (!info->drive)
> +				info->drive = 0x37;
>  			info->sense = nv_ro08(bios, ent + 7);
> -			if (!info->sense) info->sense = 0x36;
> +			if (!info->sense)
> +				info->sense = 0x36;
>  		}
>  
>  		info->type  = DCB_I2C_NV04_BIT;

Perhaps this is better handled with a new function like

int nv_ro08_default(bios, address, default)
{
	int val = nv_ro08(bios, address);
	if (val == 0)
		val = default;
	return val;
}

--
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