mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] tty: clearify structure initializer in notify_write()
@ 2011-07-30 12:01 Mathias Krause
  2011-08-16 11:03 ` Mathias Krause
  0 siblings, 1 reply; 4+ messages in thread
From: Mathias Krause @ 2011-07-30 12:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel-janitors, Mathias Krause

Even though this is valid C we should not mix C99 initializers with
obfuscated ANSI C. Stick to C99 and initialize c by its name.

Found by clang:
drivers/tty/vt/vt.c:262:55: warning: explicitly assigning a variable of
type 'unsigned int' to itself [-Wself-assign]
    struct vt_notifier_param param = { .vc = vc, unicode = unicode };
                                                 ~~~~~~~ ^ ~~~~~~~

Signed-off-by: Mathias Krause <minipli@googlemail.com>
---
 drivers/tty/vt/vt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index b3915b7..e716839 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(unregister_vt_notifier);
 
 static void notify_write(struct vc_data *vc, unsigned int unicode)
 {
-	struct vt_notifier_param param = { .vc = vc, unicode = unicode };
+	struct vt_notifier_param param = { .vc = vc, .c = unicode };
 	atomic_notifier_call_chain(&vt_notifier_list, VT_WRITE, &param);
 }
 
-- 
1.5.6.5


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

* Re: [PATCH] tty: clearify structure initializer in notify_write()
  2011-07-30 12:01 [PATCH] tty: clearify structure initializer in notify_write() Mathias Krause
@ 2011-08-16 11:03 ` Mathias Krause
  2011-08-16 15:04   ` Dan Carpenter
  0 siblings, 1 reply; 4+ messages in thread
From: Mathias Krause @ 2011-08-16 11:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, kernel-janitors, Mathias Krause

Ping, Greg?

On Sat, Jul 30, 2011 at 2:01 PM, Mathias Krause <minipli@googlemail.com> wrote:
> Even though this is valid C we should not mix C99 initializers with
> obfuscated ANSI C. Stick to C99 and initialize c by its name.
>
> Found by clang:
> drivers/tty/vt/vt.c:262:55: warning: explicitly assigning a variable of
> type 'unsigned int' to itself [-Wself-assign]
>    struct vt_notifier_param param = { .vc = vc, unicode = unicode };
>                                                 ~~~~~~~ ^ ~~~~~~~
>
> Signed-off-by: Mathias Krause <minipli@googlemail.com>
> ---
>  drivers/tty/vt/vt.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index b3915b7..e716839 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -259,7 +259,7 @@ EXPORT_SYMBOL_GPL(unregister_vt_notifier);
>
>  static void notify_write(struct vc_data *vc, unsigned int unicode)
>  {
> -       struct vt_notifier_param param = { .vc = vc, unicode = unicode };
> +       struct vt_notifier_param param = { .vc = vc, .c = unicode };
>        atomic_notifier_call_chain(&vt_notifier_list, VT_WRITE, &param);
>  }
>
> --
> 1.5.6.5

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

* Re: [PATCH] tty: clearify structure initializer in notify_write()
  2011-08-16 11:03 ` Mathias Krause
@ 2011-08-16 15:04   ` Dan Carpenter
  2011-08-16 15:47     ` Alan Cox
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-08-16 15:04 UTC (permalink / raw)
  To: Mathias Krause; +Cc: Greg Kroah-Hartman, linux-kernel, kernel-janitors

> On Sat, Jul 30, 2011 at 2:01 PM, Mathias Krause <minipli@googlemail.com> wrote:
> > Even though this is valid C we should not mix C99 initializers with
> > obfuscated ANSI C.

I saw this patch the first time and I couldn't figure out why the
original code was written that way.  I'm curious, is there some trick
here that I don't see, or is it just a typo that happens to work?

regards,
dan carpenter

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

* Re: [PATCH] tty: clearify structure initializer in notify_write()
  2011-08-16 15:04   ` Dan Carpenter
@ 2011-08-16 15:47     ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2011-08-16 15:47 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mathias Krause, Greg Kroah-Hartman, linux-kernel, kernel-janitors

On Tue, 16 Aug 2011 18:04:52 +0300
Dan Carpenter <error27@gmail.com> wrote:

> > On Sat, Jul 30, 2011 at 2:01 PM, Mathias Krause <minipli@googlemail.com> wrote:
> > > Even though this is valid C we should not mix C99 initializers with
> > > obfuscated ANSI C.
> 
> I saw this patch the first time and I couldn't figure out why the
> original code was written that way.  I'm curious, is there some trick
> here that I don't see, or is it just a typo that happens to work?

Typo looking at the original commit

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

end of thread, other threads:[~2011-08-16 15:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-30 12:01 [PATCH] tty: clearify structure initializer in notify_write() Mathias Krause
2011-08-16 11:03 ` Mathias Krause
2011-08-16 15:04   ` Dan Carpenter
2011-08-16 15:47     ` Alan Cox

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

all inboxes | Powered by JetHome®