From patchwork Thu Oct 24 19:20:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 3093491 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B9EA89F372 for ; Thu, 24 Oct 2013 19:21:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75D0D203C4 for ; Thu, 24 Oct 2013 19:21:03 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58E8D200B4 for ; Thu, 24 Oct 2013 19:21:02 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZQSn-000727-3S; Thu, 24 Oct 2013 19:20:57 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZQSk-00031n-Pi; Thu, 24 Oct 2013 19:20:54 +0000 Received: from smtprelay0050.hostedemail.com ([216.40.44.50] helo=smtprelay.hostedemail.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VZQSh-000315-0A for linux-arm-kernel@lists.infradead.org; Thu, 24 Oct 2013 19:20:51 +0000 Received: from filter.hostedemail.com (ff-bigip1 [10.5.19.254]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 2A5506B690; Thu, 24 Oct 2013 19:20:30 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::::::::::::::::::::, RULES_HIT:41:69:355:379:541:599:968:988:989:1260:1261:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3874:4250:4321:4605:5007:7652:9592:10004:10400:10848:11026:11232:11473:11658:11914:12043:12114:12296:12438 X-HE-Tag: jump54_3e3e547866742 X-Filterd-Recvd-Size: 3927 Received: from [192.168.43.164] (75.sub-70-197-86.myvzw.com [70.197.86.75]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Thu, 24 Oct 2013 19:20:27 +0000 (UTC) Message-ID: <1382642425.22433.79.camel@joe-AO722> Subject: Re: [PATCH 4/8] input: Remove OOM message after input_allocate_device From: Joe Perches To: Dmitry Torokhov Date: Thu, 24 Oct 2013 12:20:25 -0700 In-Reply-To: <20131024191032.GA5553@core.coreip.homeip.net> References: <20131024183707.GA5281@core.coreip.homeip.net> <1382640339.22433.73.camel@joe-AO722> <20131024191032.GA5553@core.coreip.homeip.net> X-Mailer: Evolution 3.6.4-0ubuntu1 Mime-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131024_152051_072201_FA86873E X-CRM114-Status: GOOD ( 22.02 ) X-Spam-Score: -1.9 (-) Cc: Kukjin Kim , Ferruh Yigit , Wan ZongShun , Andrey Moiseev , linux-kernel@vger.kernel.org, Josh Wu , linux-samsung-soc@vger.kernel.org, Henrik Rydberg , Ben Dooks , linux-input@vger.kernel.org, Pau Oliva Fora , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, 2013-10-24 at 12:10 -0700, Dmitry Torokhov wrote: > On Thu, Oct 24, 2013 at 11:45:39AM -0700, Joe Perches wrote: > > On Thu, 2013-10-24 at 11:37 -0700, Dmitry Torokhov wrote: > > > Hi Joe, > > > > > > On Wed, Oct 23, 2013 at 12:14:50PM -0700, Joe Perches wrote: > > > > Emitting an OOM message isn't necessary after input_allocate_device > > > > as there's a generic OOM and a dump_stack already done. > > > > > > No, please don't. The kzalloc may get changed in the future to not dump > > > stack (that was added originally because not everyone was handling OOM > > > properly, right?), input core might get changed to use something else > > > than kzalloc, etc, etc. > > > > > > The majority of errors use dev_err so we also get idea what device > > > failed (if there are several), and more. > > > > I think that's not valuable as input_allocate_device already has > > dozens of locations that don't emit a specific OOM and centralizing > > the location for any generic message would work anyway. > > Not having diagnostic messages in some of the drivers is hardly a > justification to remove them from everywhere else. But standardization is. If a diagnostic message is really desired without the already existing dump_stack(), it's a small matter of adding something like: drivers/input/input.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index c044699..98570c2 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1736,19 +1736,23 @@ struct input_dev *input_allocate_device(void) { struct input_dev *dev; - dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); - if (dev) { - dev->dev.type = &input_dev_type; - dev->dev.class = &input_class; - device_initialize(&dev->dev); - mutex_init(&dev->mutex); - spin_lock_init(&dev->event_lock); - INIT_LIST_HEAD(&dev->h_list); - INIT_LIST_HEAD(&dev->node); - - __module_get(THIS_MODULE); + dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL | __GFP_NOWARN); + if (!dev) { + pr_err("%pf: input_allocate_device failed\n", + __builtin_return_address(1)); + return NULL; } + dev->dev.type = &input_dev_type; + dev->dev.class = &input_class; + device_initialize(&dev->dev); + mutex_init(&dev->mutex); + spin_lock_init(&dev->event_lock); + INIT_LIST_HEAD(&dev->h_list); + INIT_LIST_HEAD(&dev->node); + + __module_get(THIS_MODULE); + return dev; } EXPORT_SYMBOL(input_allocate_device);