From patchwork Thu Apr 1 15:54:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 90156 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o31Fssv6004231 for ; Thu, 1 Apr 2010 15:54:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757048Ab0DAPyu (ORCPT ); Thu, 1 Apr 2010 11:54:50 -0400 Received: from mail-bw0-f209.google.com ([209.85.218.209]:46480 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756998Ab0DAPys (ORCPT ); Thu, 1 Apr 2010 11:54:48 -0400 Received: by bwz1 with SMTP id 1so951609bwz.21 for ; Thu, 01 Apr 2010 08:54:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=bB4pDdLlsfbUiGPo1prNdNVgXhOwY+cfw7i1ho2ZAt0=; b=avfGvYtCqEBDNvQKCJ0jmqLuTShsan4fUGEp1ACzPe6CkPq0qYiOGgVTRu1Axkjr75 C3Wwbx9sE6cYcZBv81w2gjcHcnDOuiWaOYKP3/Rzj3ujO7oPZ2fFGGGqnKfmqn6Ptqi6 M0Pa1Q+3veyO9KIymchl+RNxMxNS2I/AZpBrA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=MkXUWczcITwp4r1Vi6G4DfUZj9oiSooGZlMbvJheXD1Z8sC/PDSKH3rLRIkqn+bXwK ywBiWN5pjIO6WCrvXwMTn1AuWOLaeDGyE4WFuWxasK3z6Wo5yriFTEpZn6BoC1FV5Pk3 Iv4tlbDR1anWfW2e2HKJCiRGy7jQfLPByYb9A= Received: by 10.204.34.195 with SMTP id m3mr1611667bkd.190.1270137286874; Thu, 01 Apr 2010 08:54:46 -0700 (PDT) Received: from bicker ([196.43.68.55]) by mx.google.com with ESMTPS id 24sm68181597bkr.6.2010.04.01.08.54.42 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 01 Apr 2010 08:54:45 -0700 (PDT) Date: Thu, 1 Apr 2010 18:54:38 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Dmitry Torokhov , =?iso-8859-1?Q?M=E1rton_N=E9meth?= , Alexander Beregalov , Matthew Garrett , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] ir-keytable: avoid double lock Message-ID: <20100401155438.GE5265@bicker> Mail-Followup-To: Dan Carpenter , Mauro Carvalho Chehab , Dmitry Torokhov , =?iso-8859-1?Q?M=E1rton_N=E9meth?= , Alexander Beregalov , Matthew Garrett , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) 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.3 (demeter.kernel.org [140.211.167.41]); Thu, 01 Apr 2010 15:54:54 +0000 (UTC) diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 0a3b4ed..51cd0f3 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c @@ -216,7 +216,7 @@ static void ir_delete_key(struct ir_scancode_table *rc_tab, int elem) memcpy(&newkeymap[elem], &oldkeymap[elem + 1], (newsize - elem) * sizeof(*newkeymap)); - if (resize) { + if (resize && newkeymap != oldkeymap) { /* * As the copy happened to a temporary table, only here * it needs to lock while replacing the table pointers