From patchwork Thu Jul 28 12:46:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 1015442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6SCl17e001623 for ; Thu, 28 Jul 2011 12:47:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755372Ab1G1MqP (ORCPT ); Thu, 28 Jul 2011 08:46:15 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:39723 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754958Ab1G1MqM (ORCPT ); Thu, 28 Jul 2011 08:46:12 -0400 Received: from localhost (localhost [127.0.0.1]) by mgw2.diku.dk (Postfix) with ESMTP id BF28D19BC2F; Thu, 28 Jul 2011 14:46:11 +0200 (CEST) Received: from mgw2.diku.dk ([127.0.0.1]) by localhost (mgw2.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 25618-06; Thu, 28 Jul 2011 14:46:06 +0200 (CEST) Received: from palace.topps.diku.dk (palace.ekstranet.diku.dk [192.38.115.202]) by mgw2.diku.dk (Postfix) with ESMTP id 1A4EE19BC52; Thu, 28 Jul 2011 14:46:06 +0200 (CEST) From: Julia Lawall To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] drivers/media/dvb/dvb-usb/usb-urb.c: adjust array index Date: Thu, 28 Jul 2011 14:46:02 +0200 Message-Id: <1311857165-14780-3-git-send-email-julia@diku.dk> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1311857165-14780-1-git-send-email-julia@diku.dk> References: <1311857165-14780-1-git-send-email-julia@diku.dk> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 28 Jul 2011 12:47:01 +0000 (UTC) From: Julia Lawall Convert array index from the loop bound to the loop index. A simplified version of the semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // @@ expression e1,e2,ar; @@ for(e1 = 0; e1 < e2; e1++) { <... ar[ - e2 + e1 ] ...> } // Signed-off-by: Julia Lawall --- Not tested. drivers/media/dvb/dvb-usb/usb-urb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff -u -p a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c --- a/drivers/media/dvb/dvb-usb/usb-urb.c +++ b/drivers/media/dvb/dvb-usb/usb-urb.c @@ -148,7 +148,7 @@ static int usb_bulk_urb_init(struct usb_ if (!stream->urb_list[i]) { deb_mem("not enough memory for urb_alloc_urb!.\n"); for (j = 0; j < i; j++) - usb_free_urb(stream->urb_list[i]); + usb_free_urb(stream->urb_list[j]); return -ENOMEM; } usb_fill_bulk_urb( stream->urb_list[i], stream->udev, @@ -181,7 +181,7 @@ static int usb_isoc_urb_init(struct usb_ if (!stream->urb_list[i]) { deb_mem("not enough memory for urb_alloc_urb!\n"); for (j = 0; j < i; j++) - usb_free_urb(stream->urb_list[i]); + usb_free_urb(stream->urb_list[j]); return -ENOMEM; }