Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1084256imm; Fri, 14 Sep 2018 10:55:07 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaQUaEiAhymjlMAjeKmtHAvZd3gnj20gFmOzgSQDXW+K61GaITy109QCXcWTkgvx/Xs1Fo1 X-Received: by 2002:a17:902:8e81:: with SMTP id bg1-v6mr13476578plb.129.1536947706981; Fri, 14 Sep 2018 10:55:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536947706; cv=none; d=google.com; s=arc-20160816; b=SvpfMJOubY3oAHPFLuyb8zRkacvCPYPfgVAiwW+Rf3uMWFP0lA3INR4vBEJkak3e+f DsDYbgSfdMQJyO3A9PrOO29lZzkEiaVRm0+uH3uaDObVAjLKgjmVOdgAejFuvANls2If UimeSp6ETIAWe/+mTEyrW9j2nAf3HCn+VFjA0J+MUE92IPcqEyEpQXHIQ6OzLN+sf+M3 vplKrpUzDpJyCNwtWNKWEWvu6dL46qLTMulMMuhfrmmz1SiS78cSBP5OR1THJp39j2ga /Frfi531c9ikrFUJGeLv+OXP9Z1j11YM8Cn3ixYg8ElkF+HFjvcrGGFW6LVXKB8NxTsL OsxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=r0GmnibaRSZ4wFwzkIsbuCyBKEqgNS0mZ0XwSgt6Aa8=; b=B1d0rm4jUB0BTzNSgzg5i3zI2HDTICiJMThRXgXvx4dAcLPEpKX2WozHs+47M1o5E+ aEqL4sCTHEDnDjpNTHaUcb4Z2Rv17RN9cNOzHvNoPgfkpH2fs8+t9pPSd+aeuZXzOY3y r6isyC0qduOwQu26LaZMjUYdDL91PoC1JboOvLxUYrzg7inQ79vCIohaYCeFUq4gw2hd xKKFYCdu7wqL15R5JNky2HOiTwKQioUXvkZlHu+n/TQxDFq6gpwWp1ezhOfstuoiW+fO tKWg9vrdSeTNVbQ2ofvFKfcoBISIHb3CfroCkEgYPRiJBmma13I7ca4STMBuew+ABC4J aYhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="mYC/Zh0u"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si7161790ply.354.2018.09.14.10.54.51; Fri, 14 Sep 2018 10:55:06 -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=@google.com header.s=20161025 header.b="mYC/Zh0u"; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728489AbeINXIb (ORCPT + 99 others); Fri, 14 Sep 2018 19:08:31 -0400 Received: from mail-ua1-f74.google.com ([209.85.222.74]:46609 "EHLO mail-ua1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726891AbeINXIa (ORCPT ); Fri, 14 Sep 2018 19:08:30 -0400 Received: by mail-ua1-f74.google.com with SMTP id g12-v6so3093755ual.13 for ; Fri, 14 Sep 2018 10:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=r0GmnibaRSZ4wFwzkIsbuCyBKEqgNS0mZ0XwSgt6Aa8=; b=mYC/Zh0uRegj4vGYNsV8AvfhYiXSXpmqCFsTBrZetRnA+T/GMFKczsR5RmHotp/HQQ FpEQ5HQiHIKlIunJMD4z1EpyVU3UMv5RBi1n8VTyk+u+tLxcwlqEfym/2HTs/WKDzR3m LIsCY0LH309lcaMWZSR3JF3QzF7LhrKCY7M9z0ufO25nhoJcNk3QCwAaCxi0dpaZOQD5 SPNloNnj4V3IzNvvgvw88+GfmfAhPp9Rg+Es/HvY6Oa9Uc9DV3AeulrjMXh8f+QRCcJ1 xfn6GMqCH59AFNlCPLjHCacChwg884AUp2CmRMhkQqS3QiFHnMmU/3UWd7KnvE/NDjcc MeIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=r0GmnibaRSZ4wFwzkIsbuCyBKEqgNS0mZ0XwSgt6Aa8=; b=Ghfnz7aJQPMLePx8cVyE/5a0DgIAI9iqRcV6CTVxXB19hHxJlmI+MFAbpcouO0zY7d 1bGaf1vjd/P9LR5RyzKRatpiq9/fTxNSQb7dFnponAdURxmlO3Y/620A74uvFnJv6DoV uuXzmjAVl02XGlf5dE9tsMiaDyFrdbfEtGd/Zb5o/ciynwgVkctbrf7FkE7oJliqsKY2 6eCwjiGrGsoAsz/6l3JHGQwNUWFRdFyfwBw9KX4cDO7cFM6adTIXPaorlW5zpb3xgey8 P/Ei1trEzEvosEcamPzrpPirclBbVdz4KHuYWSvNOalLGPM5yRK6jjjRUUFybYkHrdYS vV+A== X-Gm-Message-State: APzg51BJ6+o+ElvUbYqELrYhRFDx2v/2sZwjAfWuqcSvPvQx0xaORRwW YYcILBgu07n6Jpz3BseLRSu271M2 X-Received: by 2002:ab0:48d2:: with SMTP id y18-v6mr2896473uac.63.1536947576699; Fri, 14 Sep 2018 10:52:56 -0700 (PDT) Date: Fri, 14 Sep 2018 10:51:17 -0700 In-Reply-To: <20180914175122.21036-1-rkir@google.com> Message-Id: <20180914175122.21036-16-rkir@google.com> Mime-Version: 1.0 References: <20180914175122.21036-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.397.gdd90340f6a-goog Subject: [PATCH 16/21] platform: goldfish: pipe: Call misc_deregister if init fails From: rkir@google.com To: gregkh@linuxfoundation.org Cc: tkjos@google.com, linux-kernel@vger.kernel.org, Roman Kiryanov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Roman Kiryanov Undo effects of misc_register if driver's init fails after misc_register. Signed-off-by: Roman Kiryanov --- drivers/platform/goldfish/goldfish_pipe_v2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c b/drivers/platform/goldfish/goldfish_pipe_v2.c index 9fa5136be909..e3358c682562 100644 --- a/drivers/platform/goldfish/goldfish_pipe_v2.c +++ b/drivers/platform/goldfish/goldfish_pipe_v2.c @@ -1159,8 +1159,10 @@ int goldfish_pipe_device_v2_init(struct platform_device *pdev, dev->pipes_capacity = INITIAL_PIPES_CAPACITY; dev->pipes = kcalloc(dev->pipes_capacity, sizeof(*dev->pipes), GFP_KERNEL); - if (!dev->pipes) + if (!dev->pipes) { + misc_deregister(&dev->miscdev); return -ENOMEM; + } /* * We're going to pass two buffers, open_command_params and @@ -1173,6 +1175,7 @@ int goldfish_pipe_device_v2_init(struct platform_device *pdev, __get_free_page(GFP_KERNEL); if (!dev->buffers) { kfree(dev->pipes); + misc_deregister(&dev->miscdev); return -ENOMEM; } -- 2.19.0.397.gdd90340f6a-goog