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: <20180628051941.GF629@localhost>
Date:   Thu, 28 Jun 2018 07:19:41 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Sean Wang <sean.wang@...iatek.com>
Cc:     Andy Shevchenko <andy.shevchenko@...il.com>,
        Mark Rutland <mark.rutland@....com>,
        devicetree <devicetree@...r.kernel.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Marcel Holtmann <marcel@...tmann.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-bluetooth@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v4 6/7] Bluetooth: mediatek: Add protocol support for
 MediaTek serial devices

On Thu, Jun 28, 2018 at 11:06:13AM +0800, Sean Wang wrote:
> On Wed, 2018-06-27 at 20:04 +0300, Andy Shevchenko wrote:
> > On Wed, Jun 27, 2018 at 7:59 PM, Andy Shevchenko
> > <andy.shevchenko@...il.com> wrote:
> > > On Wed, Jun 27, 2018 at 8:43 AM,  <sean.wang@...iatek.com> wrote:
> > >> From: Sean Wang <sean.wang@...iatek.com>

> > >> +#include <net/bluetooth/bluetooth.h>
> > >> +#include <net/bluetooth/hci_core.h>
> > 
> > >> +       /* Enable the power domain and clock the device requires. */
> > >> +       pm_runtime_enable(dev);
> > >> +       err = pm_runtime_get_sync(dev);
> > >> +       if (err < 0)
> > >> +               goto err_pm2;

> > >> +err_pm1:
> > >> +       pm_runtime_put_sync(dev);
> > >> +err_pm2:
> > >> +       pm_runtime_disable(dev);

Please name error labels after what they do, not using numbers (see
CodingStyle). Here you could use err_disable_rpm instead of err_pm2, for
example.

Also, if you really want to undo pm_runtime_get_sync() failing above,
you still need a pm_runtime_put_noidle() to balance the usage count.

> > >> +struct mtk_stp_hdr {
> > >> +       __u8 prefix;
> > >> +       __u8 dlen1:4;
> > >> +       __u8 type:4;
> > 
> > >> +       __u8 dlen2:8;
> > >> +       __u8 cs;
> > >> +} __packed;

Perhaps too much context have been lost here, but unless you're sharing
this struct with user space, you should be using u8 (without __) above
(and elsewhere).

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ