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: <001601cb7fca$918dc5e0$66f8800a@maildom.okisemi.com>
Date:	Tue, 9 Nov 2010 13:57:05 +0900
From:	"Toshiharu Okada" <toshiharu-linux@....okisemi.com>
To:	Michał Nazarewicz <m.nazarewicz@...sung.com>,
	"Andy Isaacson" <adi@...apodia.org>
Cc:	"Greg Kroah-Hartman" <gregkh@...e.de>,
	"LKML" <linux-kernel@...r.kernel.org>,
	"linux-usb" <linux-usb@...r.kernel.org>,
	"Wang, Qi" <qi.wang@...el.com>,
	"Wang, Yong Y" <yong.y.wang@...el.com>,
	"Andrew" <andrew.chih.howe.khor@...el.com>,
	"Intel OTC" <joel.clark@...el.com>,
	"Foster, Margie" <margie.foster@...el.com>,
	"Ewe, Kok Howg" <kok.howg.ewe@...el.com>
Subject: Re: [PATCH v7] USB device driver of Topcliff PCH

Hi Michal

Thank you for your comment.
I will modify to "if-else-if-else" as follows.

-----------
if (!list_empty(&ep->queue)) {
    dev_dbg(&dev->pdev->dev, "%s: list not empty", __func__);
    ret = -EAGAIN;
} else {
    if (halt) { /* halt or clear halt */
        if (ep->num == PCH_UDC_EP0)
            ep->dev->stall = 1;
        pch_udc_ep_set_stall(ep);
        pch_udc_enable_ep_interrupts(ep->dev, PCH_UDC_EPINT(ep->in,
ep->num));
        ret = 0;
    } else {
        pch_udc_ep_clear_stall(ep);
        ret = 0;
    }
}
-------------

Best regards
Toshiharu Okada (OKI SEMICONDUCTOR)
-----
Date: Mon, 08 Nov 2010 12:22:51 +0100
From: "Michał Nazarewicz" <m.nazarewicz@...sung.com>
> On Wed, 03 Nov 2010 19:37:50 +0100, Andy Isaacson <adi@...apodia.org>
wrote:
> > I think this would be clearer as
> >
> > + if (!list_empty(&ep->queue)) {
> > + dev_dbg(&dev->pdev->dev, "%s: list not empty", __func__);
> > + ret = -EAGAIN;
> > + }
> > + if (halt) {
> > + if (ep->num == PCH_UDC_EP0)
> > + ep->dev->stall = 1;
> > + pch_udc_ep_set_stall(ep);
> > + pch_udc_enable_ep_interrupts(ep->dev,
> > +      PCH_UDC_EPINT(ep->in, ep->num));
> > + ret = 0;
> > + } else {
> > + pch_udc_ep_clear_stall(ep);
> > + ret = 0;
> > + }
>
> This changes the behavior of the construct though.
>
> > because:
> > 1. if (!list_empty  is a standalone check, there is no if/else if/else
> > connection between list_empty() and halt.
>
> This depends on how you look at it.  The way I see it is that there are
three
> mutually exclusive cases: the list is not empty, it is a halt, it is not a
> halt.  This way, if-else-if-else seems like a good construct to me.
>
> > 2. I prefer if (foo) {} else {} instead of if (!foo) {} else {}, unless
> > there is a significant reason to do the negated test.
>
> I agree on that though.
>
> >> + pr_debug("%s: %s", __func__, usbep->name);
> >
> > There are probably too many pr_debug() and dev_dbg()s in this driver.
> > Please reconsider which ones are appropriate for mainline.
>
> Do we really care?  Just don't define DEBUG...
>
> -- 
> Best regards,                                        _     _
> | Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
> | Computer Science,  Michał "mina86" Nazarewicz       (o o)
> +----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ