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]
Message-ID: <20150311090911.GW10964@mwanda>
Date:	Wed, 11 Mar 2015 12:09:11 +0300
From:	Dan Carpenter <dan.carpenter@...cle.com>
To:	Lorenzo Stoakes <lstoakes@...il.com>
Cc:	sudipm.mukherjee@...il.com, teddy.wang@...iconmotion.com,
	gregkh@...uxfoundation.org, devel@...verdev.osuosl.org,
	linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] staging: sm750fb: Spinlock and unlock in the same
 block

On Wed, Mar 11, 2015 at 01:28:45AM +0000, Lorenzo Stoakes wrote:
> -static inline void myspin_lock(spinlock_t * sl){
> -	struct lynx_share * share;
> -	share = container_of(sl,struct lynx_share,slock);
> -	if(share->dual){
> -		spin_lock(sl);
> -	}
> -}

Yes, good.  We all hate locking wrappers but these are worse than
normal.

> +	/* if not use spin_lock,system will die if user load driver
> +	 * and immediatly unload driver frequently (dual)*/
> +	if (share->dual) {
> +		spin_lock(&share->slock);
> +		share->accel.de_fillrect(&share->accel,
> +					base,pitch,Bpp,
> +					region->dx,region->dy,
> +					region->width,region->height,
> +					color,rop);
> +		spin_unlock(&share->slock);
> +	} else
> +		share->accel.de_fillrect(&share->accel,
> +					base,pitch,Bpp,
> +					region->dx,region->dy,
> +					region->width,region->height,
> +					color,rop);
>  }

No.  You've made the code uglier to work around Sparse stupidness.  Also
the braces are not according to kernel style.

	if (share->dual)
		spin_lock(&share->slock);

	share->accel.de_fillrect(&share->accel,
				 base,pitch,Bpp,
				 region->dx,region->dy,
				 region->width,region->height,
				 color,rop);

	if (share->dual)
		spin_unlock(&share->slock);

Sparse will still complain but no one cares.

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