From: Pavel Skripkin <paskripkin@gmail.com>
To: Ajay Garg <ajaygargnsit@gmail.com>
Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org,
andriy.shevchenko@linux.intel.com, kernel@esmil.dk,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] tty: vt: keyboard: add default switch-case, to handle smatch-warnings in method vt_do_kdgkb_ioctl
Date: Sun, 7 Nov 2021 01:25:54 +0300 [thread overview]
Message-ID: <b7520698-44ef-55db-2b0f-ed47cd7d8b71@gmail.com> (raw)
In-Reply-To: <CAHP4M8VmPTiWjVa_PEMs+XT0VzsoAw8BuO-KBo08Uwuf=T1WFw@mail.gmail.com>
On 11/7/21 01:17, Ajay Garg wrote:
> On Sun, Nov 7, 2021 at 3:42 AM Pavel Skripkin <paskripkin@gmail.com> wrote:
>>
>> On 11/7/21 01:03, Ajay Garg wrote:
>> > diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
>> > index c7fbbcdcc346..b83e7669658d 100644
>> > --- a/drivers/tty/vt/keyboard.c
>> > +++ b/drivers/tty/vt/keyboard.c
>> > @@ -2090,6 +2090,12 @@ int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)
>> >
>> > ret = 0;
>> > break;
>> > + default: {
>> > + kbs = NULL;
>> > + ret = -ENOIOCTLCMD;
>> > +
>> > + break;
>> > + }
>>
>> Are these brackets needed here? There are no local variables inside
>> default case.
>
> Hmm,
>
> * case KDGKBSENT: uses braces.
> * case KDSKBSENT: does not use braces.
>
> I based the layout for default-case on the same lines as case
> KDGKBSENT: , as I prefer explicit braces :)
>
I am not against these braces, but I, honestly, dislike them, because
`case : {` syntax looks ugly _to me_.
KDGKBSENT uses it because of local variable `len` and not using them
will cause build error.
I didn't find any strict requirements to not use brackets when there is
no local variable, so it's up to maintainers (again).
Anyway, thank for respinning :)
With regards,
Pavel Skripkin
next prev parent reply other threads:[~2021-11-06 22:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-06 22:03 Ajay Garg
2021-11-06 22:12 ` Pavel Skripkin
2021-11-06 22:17 ` Ajay Garg
2021-11-06 22:25 ` Pavel Skripkin [this message]
2021-11-07 3:21 ` Ajay Garg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b7520698-44ef-55db-2b0f-ed47cd7d8b71@gmail.com \
--to=paskripkin@gmail.com \
--cc=ajaygargnsit@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kernel@esmil.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®