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: <CAKohponxbjTTDMOA_0=MT36wRh1NpzTAH4LdkaE=Z-ahup4BFg@mail.gmail.com>
Date:	Fri, 12 Oct 2012 16:31:31 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	Andy Shevchenko <andy.shevchenko@...il.com>
Cc:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	vinod.koul@...el.com, linux-kernel@...r.kernel.org,
	spear-devel@...t.st.com, linux-arm-kernel@...ts.infradead.org,
	devicetree-discuss@...ts.ozlabs.org
Subject: Re: [PATCH 2/3] dmaengine: dw_dmac: Enhance device tree support

On 12 October 2012 16:10, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>>>> +     if (!found) {
>>>> +             last_dw = dw;
>>>> +             last_bus_id = param;
>>>> +             return false;
>>> Because of return here you could eliminate 'found' flag at all.

Here is the stuff copied from you ;)


diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
index a4ff04c..c24859e 100644
--- a/drivers/dma/dw_dmac.c
+++ b/drivers/dma/dw_dmac.c
@@ -1184,7 +1184,7 @@ bool dw_generic_filter(struct dma_chan *chan, void *param)
        struct dw_dma *dw = to_dw_dma(chan->device);
        static struct dw_dma *last_dw;
        static char *last_bus_id;
-       int found = 0, i = -1;
+       int i = -1;

        /*
         * dmaengine framework calls this routine for all channels of all dma
@@ -1212,22 +1212,17 @@ bool dw_generic_filter(struct dma_chan *chan,
void *param)

        while (++i < dw->sd_count) {
                if (!strcmp(dw->sd[i].bus_id, param)) {
-                       found = 1;
-                       break;
-               }
-       }
+                       chan->private = &dw->sd[i];
+                       last_dw = NULL;
+                       last_bus_id = NULL;

-       if (!found) {
-               last_dw = dw;
-               last_bus_id = param;
-               return false;
+                       return true;
+               }
        }

-       chan->private = &dw->sd[i];
-       last_dw = NULL;
-       last_bus_id = NULL;
-
-       return true;
+       last_dw = dw;
+       last_bus_id = param;
+       return false;
 }
 EXPORT_SYMBOL(dw_generic_filter);
--
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