Re: [PATCH v3] tty: vt: keyboard: add default switch-case, to handle smatch-warnings in method vt_do_kdgkb_ioctl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Nov 7, 2021 at 3:42 AM Pavel Skripkin <paskripkin@xxxxxxxxx> 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 :)



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux