Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756923AbZJFKKW (ORCPT ); Tue, 6 Oct 2009 06:10:22 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756327AbZJFKKV (ORCPT ); Tue, 6 Oct 2009 06:10:21 -0400 Received: from www.tglx.de ([62.245.132.106]:47674 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756850AbZJFKKT (ORCPT ); Tue, 6 Oct 2009 06:10:19 -0400 Date: Tue, 6 Oct 2009 12:09:36 +0200 (CEST) From: Thomas Gleixner To: Sven-Thorsten Dietrich cc: Frederik Deweerdt , LKML , linux-rt-users Subject: Re: [PATCH][UHCI-DEBUG] Don't kmalloc with BKL held In-Reply-To: <1254573359.11691.0.camel@sven.thebigcorporation.com> Message-ID: References: <1254474744.28661.2.camel@sven.thebigcorporation.com> <20091002092021.GA25083@gambetta> <1254573359.11691.0.camel@sven.thebigcorporation.com> User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1837 Lines: 61 On Sat, 3 Oct 2009, Sven-Thorsten Dietrich wrote: > On Fri, 2009-10-02 at 09:20 +0000, Frederik Deweerdt wrote: > > Hi Sven-Thorsten, > > > > On Fri, Oct 02, 2009 at 11:12:24AM +0200, Sven-Thorsten Dietrich wrote: > > > Subject: Don't kmalloc with BKL held. > > > From: Sven-Thorsten Dietrich > > > > > > I'm eyeballing this file for complete removal of lock_kernel but > > > at first glance, we definitely don't need BKL to kmalloc(). > > You need to move the unlock_kernel() above the out: label too. > > > > How about this ? > > Subject: Don't kmalloc with BKL held. > From: Sven-Thorsten Dietrich sdietrich@suse.de Sat Oct 3 01:27:27 2009 -0700 > Date: Sat Oct 3 01:27:27 2009 -0700: > Git: 4f62eb81e827eb857129101e49757d84ac9ee7eb > > We don't need BKL to kmalloc > > diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c > index e52b954..3fd5602 100644 > --- a/drivers/usb/host/uhci-debug.c > +++ b/drivers/usb/host/uhci-debug.c > @@ -494,32 +494,30 @@ static int uhci_debug_open(struct inode *inode, struct file *file) > { > struct uhci_hcd *uhci = inode->i_private; > struct uhci_debug *up; > - int ret = -ENOMEM; > unsigned long flags; > > - lock_kernel(); > up = kmalloc(sizeof(*up), GFP_KERNEL); > if (!up) > - goto out; > + return -ENOMEM; > > up->data = kmalloc(MAX_OUTPUT, GFP_KERNEL); > if (!up->data) { > kfree(up); > - goto out; > + return -ENOMEM; > } > > up->size = 0; > + > + lock_kernel(); Why don't you remove it completely ? That lock_kernel() protects exactly nothing. Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/