Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1123013ybl; Wed, 14 Aug 2019 11:05:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwu7TyVCdzz/qA6HF7lx0CUa9SoKXBN3bwX7ACi7UZEHFge3OGcSR1N4Mg83c5VBzo3aH3F X-Received: by 2002:a17:90a:c714:: with SMTP id o20mr940691pjt.50.1565805926076; Wed, 14 Aug 2019 11:05:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565805926; cv=none; d=google.com; s=arc-20160816; b=nPn0LrosJFdN8W/u3sBfH/v5lMqAq/OswNfQBEZNG9vhdMQG9hpaWgrq+vBcoKLVGk vs9n9O5QOaeAohlxN1L6fEaRzbGaislYTIFZgRB3FQ6uxZ4xz/pyHOtAHs/Jl/uLTy/b KBjSulO0qZdqOYFXFSVdIaqUpA5nj0g8zcWmPRikZerFIqmjFaFyZ1NiyEj8YIp+e4zP G8sGCCENv/2YVGZQTDfPf5AZr22vMeGRPRIcw4ZRTaeIScJ9wRPWCCTI/lwxhuW8ZkhB l3QZkHNX5g0JNrtSSaeH/U7Hi0l/ikZ9nRGcbAqvS9z5lzCbTLZYBIaLx90NqDOIVPxF /C0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=i65TMBvSXi6h25YTw/qjPwCNbGJI3tR/idiaX47L8Ck=; b=RxP6ws0gHD+28K8/NlyxR9mLyg/L5uFV2zPJKMhFns0x1mi1Ba/QIiXOLyj+9u4PRR A6WjRhxMhhFfrXlk8vx4ep1Jk1umVTtPRpdP2VIomdniBiYuwsmadmNR/hdniHGA/Yfx OhbVHlXxOcb1ANSNOziifWtNF78DYuvWNsj69gCiPx91M7E8NxgyOizMfO4WL2uOL6lq 0qkfVXCsEN89q8bC9j/uiFj0cNPS1v/pWylHqNbpj3GNBQm+D+LKdgiQ44i0N8Hwq37l 2nKsaR0bwTUyOlivhPDH4uaJDoIdKHEDa7Lr3mXC2rOoog7Ohcm28UJJXd569lFIdux9 an8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oDgz7DWI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j5si274470pjf.60.2019.08.14.11.05.09; Wed, 14 Aug 2019 11:05:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oDgz7DWI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729089AbfHNSEU (ORCPT + 99 others); Wed, 14 Aug 2019 14:04:20 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:32993 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728301AbfHNSET (ORCPT ); Wed, 14 Aug 2019 14:04:19 -0400 Received: by mail-pl1-f196.google.com with SMTP id c14so50923457plo.0; Wed, 14 Aug 2019 11:04:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i65TMBvSXi6h25YTw/qjPwCNbGJI3tR/idiaX47L8Ck=; b=oDgz7DWIxwNG9Rs8Av0aGQCb4Y4zM1LQ1tAIMtpGam4wL/8Gxup4y2oPyAmIxWlcIU kFLQtS/AH/pC6D3MgtHWR9wg4hJ8t7xgrFUhclrPwzaVA5FyFlC0I/QalhEl2xy39Ffo eSuQi/eiDx0fZE+0aJqR9uDc+19OfkJ3osRSnctH5h8O/aOk9KsZZRg/A1/+0Tw2jl1a +CwRtB5bOqJvNipwLJ31AP3rI2NRvqwMQvjjVBoOhKueYR/6UdtBYuQgyj/AkrOQao2w gkwPUGt/gn4vewJtfXhQp0BRvUYwhtL3OjR11guj+ZKxR5BlILFL/gYphITtDECXwsJV 4zQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=i65TMBvSXi6h25YTw/qjPwCNbGJI3tR/idiaX47L8Ck=; b=JQJdFqrg73K4bOsDiRvK/+npZVbRPJe+3vK6v4sO7goRjG8JPG9ALLItbJjG/XNCZR /hXeTJcd2knfhMQCftdI2mWsRAYqUIe1YfJQCPQJrvFuOS8tZXH4GgHM/uQfJ2P4V5fA AFzsVqECfgCTsGS3cKe2auXkNo9MAaB5avOBz2lRNvLVmkAT6Orh2UiQXRoeUoeb7FJr +lpeNXK3l0F3oOlr/Cko05/NIpUzWCoyX7tckl9GhP8YTdr9fh5wR0YJiyQXR2QZnFXY 1VpDxW1UuH71OAgUfTKVz7Optpg7fB+NgQVsZhCDaLlDmC54gRSFkVGH7hvzAKVIae25 nUKw== X-Gm-Message-State: APjAAAX33uVnppEVISY4+XWuJUTkFsd4A+34vTUf8dLgN0Ns0GWzowa+ D9KMcFLTwA7coN4cSWFYtBk= X-Received: by 2002:a17:902:b105:: with SMTP id q5mr596304plr.81.1565805858657; Wed, 14 Aug 2019 11:04:18 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id i126sm540372pfb.32.2019.08.14.11.04.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:04:17 -0700 (PDT) Date: Wed, 14 Aug 2019 11:04:15 -0700 From: Dmitry Torokhov To: Jonas Gorski Cc: Thomas Bogendoerfer , Ralf Baechle , Paul Burton , James Hogan , Lee Jones , "David S. Miller" , Srinivas Kandagatla , Alessandro Zummo , Alexandre Belloni , Greg Kroah-Hartman , Jiri Slaby , Evgeniy Polyakov , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Network Development , linux-rtc@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH v4 9/9] Input: add IOC3 serio driver Message-ID: <20190814180415.GC121898@dtor-ws> References: <20190809103235.16338-1-tbogendoerfer@suse.de> <20190809103235.16338-10-tbogendoerfer@suse.de> <20190814163733.82f624e342d061866ba8ff87@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 14, 2019 at 06:57:55PM +0200, Jonas Gorski wrote: > On Wed, 14 Aug 2019 at 16:37, Thomas Bogendoerfer wrote: > > > > On Wed, 14 Aug 2019 15:20:14 +0200 > > Jonas Gorski wrote: > > > > > > + d = devm_kzalloc(&pdev->dev, sizeof(*d), GFP_KERNEL); > > > > > > &pdev->dev => dev > > > > will change. > > > > > > > > > + if (!d) > > > > + return -ENOMEM; > > > > + > > > > + sk = kzalloc(sizeof(*sk), GFP_KERNEL); > > > > > > any reason not to devm_kzalloc this as well? Then you won't need to > > > manually free it in the error cases. > > > > it has different life time than the device, so it may not allocated > > via devm_kzalloc > > > > > > +static int ioc3kbd_remove(struct platform_device *pdev) > > > > +{ > > > > + struct ioc3kbd_data *d = platform_get_drvdata(pdev); > > > > + > > > > + devm_free_irq(&pdev->dev, d->irq, d); > > > > + serio_unregister_port(d->kbd); > > > > + serio_unregister_port(d->aux); > > > > + return 0; > > > > +} > > > > > > and on that topic, won't you need to kfree d->kbd and d->aux here? > > > > that's done in serio_release_port() by the serio core. > > i see. But in that case, don't the kfree's after the > serio_unregister_port's in the error path of the .probe function cause > a double free? Yes they do, we need to drop kfree()s from there. Nicely spotted. Thanks. -- Dmitry