public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm: Reduce scope of 'state' variable
@ 2017-06-15 14:04 Dawid Kurek
  2017-06-15 17:31 ` Sean Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Dawid Kurek @ 2017-06-15 14:04 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie, dri-devel,
	linux-kernel

Smaller scope reduces visibility of variable and makes usage of
uninitialized variable less possible.

Changes in v2:
	- separate declaration and initialization
---
 drivers/gpu/drm/drm_atomic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index f32506a..5e0d1e1 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -108,9 +108,10 @@ struct drm_atomic_state *
 drm_atomic_state_alloc(struct drm_device *dev)
 {
 	struct drm_mode_config *config = &dev->mode_config;
-	struct drm_atomic_state *state;
 
 	if (!config->funcs->atomic_state_alloc) {
+		struct drm_atomic_state *state;
+
 		state = kzalloc(sizeof(*state), GFP_KERNEL);
 		if (!state)
 			return NULL;
-- 
2.10.0


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm: Reduce scope of 'state' variable
  2017-06-15 14:04 [PATCH v2] drm: Reduce scope of 'state' variable Dawid Kurek
@ 2017-06-15 17:31 ` Sean Paul
  2017-06-15 17:43   ` Dawid Kurek
  0 siblings, 1 reply; 3+ messages in thread
From: Sean Paul @ 2017-06-15 17:31 UTC (permalink / raw)
  To: Dawid Kurek
  Cc: Daniel Vetter, Jani Nikula, Sean Paul, David Airlie, dri-devel,
	linux-kernel

On Thu, Jun 15, 2017 at 04:04:36PM +0200, Dawid Kurek wrote:
> Smaller scope reduces visibility of variable and makes usage of
> uninitialized variable less possible.
> 
> Changes in v2:
> 	- separate declaration and initialization

Your patch is missing Signed-off-by tag

Sean

> ---
>  drivers/gpu/drm/drm_atomic.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index f32506a..5e0d1e1 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -108,9 +108,10 @@ struct drm_atomic_state *
>  drm_atomic_state_alloc(struct drm_device *dev)
>  {
>  	struct drm_mode_config *config = &dev->mode_config;
> -	struct drm_atomic_state *state;
>  
>  	if (!config->funcs->atomic_state_alloc) {
> +		struct drm_atomic_state *state;
> +
>  		state = kzalloc(sizeof(*state), GFP_KERNEL);
>  		if (!state)
>  			return NULL;
> -- 
> 2.10.0
> 
> 
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus

-- 
Sean Paul, Software Engineer, Google / Chromium OS

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] drm: Reduce scope of 'state' variable
  2017-06-15 17:31 ` Sean Paul
@ 2017-06-15 17:43   ` Dawid Kurek
  0 siblings, 0 replies; 3+ messages in thread
From: Dawid Kurek @ 2017-06-15 17:43 UTC (permalink / raw)
  To: Sean Paul
  Cc: Daniel Vetter, Jani Nikula, David Airlie, dri-devel, linux-kernel

On 15/06/17, Sean Paul wrote:
> On Thu, Jun 15, 2017 at 04:04:36PM +0200, Dawid Kurek wrote:
> > Smaller scope reduces visibility of variable and makes usage of
> > uninitialized variable less possible.
> > 
> > Changes in v2:
> > 	- separate declaration and initialization
> 
> Your patch is missing Signed-off-by tag
> 
Right... Missed it. v3 on the way.

Dawid

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-15 17:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-15 14:04 [PATCH v2] drm: Reduce scope of 'state' variable Dawid Kurek
2017-06-15 17:31 ` Sean Paul
2017-06-15 17:43   ` Dawid Kurek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox