From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Mack Subject: Re: [PATCH 2/2] net: ethernet: cpsw: fix interrupt lookup logic in cpsw_probe() Date: Wed, 03 Sep 2014 10:23:46 +0200 Message-ID: <5406D012.6030601@zonque.org> References: <1409676245-13897-1-git-send-email-zonque@gmail.com> <1409676245-13897-2-git-send-email-zonque@gmail.com> <5406C336.3020005@ti.com> <5406C3A2.4060103@zonque.org> <5406CFD9.6060706@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: julia.lawall@lip6.fr, netdev@vger.kernel.org, george.cherian@ti.com To: Mugunthan V N , davem@davemloft.net Return-path: Received: from svenfoo.org ([82.94.215.22]:52275 "EHLO mail.zonque.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbaICIXs (ORCPT ); Wed, 3 Sep 2014 04:23:48 -0400 In-Reply-To: <5406CFD9.6060706@ti.com> Sender: netdev-owner@vger.kernel.org List-ID: On 09/03/2014 10:22 AM, Mugunthan V N wrote: > On Wednesday 03 September 2014 01:00 PM, Daniel Mack wrote: >> On 09/03/2014 09:28 AM, Mugunthan V N wrote: >>> On Tuesday 02 September 2014 10:14 PM, Daniel Mack wrote: >>>> The code in cpsw_probe() currently iterates over the available >>>> interrupt resources and requests each of them. While doing so, it >>>> keeps track of their indices through priv->irqs_table. >>>> >>>> However, the code currently only remembers the last interrupt in >>>> a resource, and will leak the others if there is more than one. >>>> This can only happen for board-file driven platforms and not via DT, >>>> however. >>>> >>>> Also, there is currently no bounds check, while priv->irqs_table is a >>>> fixed-size array. If we are passed more than 4 resources, we're in >>>> trouble. >>>> >>>> This patch introduces a bounds check and changes the way interrupt >>>> indices are kept. Tested on a Beagle Bone Black board only. >>>> >>>> Signed-off-by: Daniel Mack >>> >>> The drivers is not supported for non-DT platforms as all the platforms >>> which uses CPSW are DT only platforms. >> >> Ok, thanks for explaining. >> >> But then we can remove the iteration then and simplify the code, right? >> The bounds check should also be done. >> > > Right, we can simplify the code. Ok, I'll cook up a new patch. Thanks! Daniel