Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1852844imm; Tue, 2 Oct 2018 15:21:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV61EvocYs7Bhdet1Locl4syB1ZBRshzL2pzd74Yk9NLAfl5jgvpwZKAw13KGstBhb/mgDGpK X-Received: by 2002:a63:e116:: with SMTP id z22-v6mr1829962pgh.20.1538518890844; Tue, 02 Oct 2018 15:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538518890; cv=none; d=google.com; s=arc-20160816; b=xCAjbensYPF4pC8p7ZeR+su3bi8Lx4/HxKvnYEajMTtGKPLjJ1tYufbIG1cbodZ7W6 afCgt44uQX7feGrzsmw33BUA1f5R73AKe5pTo589M5BsweJzALP3bYaASKh8Caai9w2f 6XsKCVaTgD0jEyZjpxAC+uCpt8bxpgz/SVSDNpDTYqr2PM4YWp8L/HyudkY4DTvEG2X7 dFHDyXM0CEkYW1o/rrIii132udC7LMjrXhxinM8/CWbjuXyUIaRVBF/nvFQHHNQ9ALpv HAyOImv/95gbdai3EKGktrZXRToAbeoKfueCAvz95IlGVxNdZR6PuY2OUKR+6ENbi8Os 3pqQ== 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=z9XoGmB/wm15KgwqXF8ZoXAWypqHpinkJPu48yHLcLg=; b=xbO7EuRxsI/zzmFO2DMTZC4nJi5ttrYUPNtJTLRZvRNA8/Uh6UctCSeT/iEjYUP29i 57cnm4OXfNu3kbSVanQqg/Bns822g+WsfxLpoSZU9i/uBKyZQHitt06Gf023f5s3JmvZ mRzTJyCnA9GvY/nIrqiSwkl+T1R1LQ2xPKC4u+qw9rTsgYrEGeovKMdwwHTsRJfgyemY Q8BZFPN00X986564Ha335NMGHXR2QoPxDdK2sQUgK79qGOdruvEd4qvvhs12my7cRhzz 3Iq2VBQsmPY+C6FhM1SS9Tv2do6vEYWZO8Gp17ck4M6j7a2u4b49rnBM4PdUnevs+7ta wKzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="McHsi/kB"; 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 e3-v6si15663730pgg.530.2018.10.02.15.21.15; Tue, 02 Oct 2018 15:21:30 -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="McHsi/kB"; 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 S1727581AbeJCFFw (ORCPT + 99 others); Wed, 3 Oct 2018 01:05:52 -0400 Received: from mail-ot1-f73.google.com ([209.85.210.73]:50786 "EHLO mail-ot1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725198AbeJCFFv (ORCPT ); Wed, 3 Oct 2018 01:05:51 -0400 Received: by mail-ot1-f73.google.com with SMTP id e69-v6so2430028ote.17 for ; Tue, 02 Oct 2018 15:20:17 -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=z9XoGmB/wm15KgwqXF8ZoXAWypqHpinkJPu48yHLcLg=; b=McHsi/kBNY/vSGX7Qc2+eV3peAeE2eFog3G5QRWYQC3jFQSM6BQOXFU4q2U92cW5xs e28Yo+FQEfMK81FZ0FS4OHdv7EaEe5yiZtBHq+t3GkCEcyMlMLPKKLxzsCaNVlyROpRi jKY7Z3rST+hbzvntBL7JfsSPvVHfXw6ICJZQPQxDJRm0wPAWVD88KqocI0uPTZLhr5hL 1R7g897XvdZhPOWpQHkfz3tAokbUEzTGF0/Ng9QJWoXkOW3bTuV5IBsyfHdLOjwwVjMi ueKzkU9kAVmxS4GnVvzwnh2XmATy16aE/tSG+aq2ncbYvSPHVxN0jx+y3jva8stzQyjU 1ZFA== 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=z9XoGmB/wm15KgwqXF8ZoXAWypqHpinkJPu48yHLcLg=; b=uRdWpn+NGPSkD51t3RcyUnJZzY8WpJji2ffwnR4Q1gCXNvibjiiGJzH97vtpMhgPhi DEPzgU3ehktSwKzZJOTLX1LJeeDAlrZzsJLDjKsPD8EOKOA8HDj9UUcsgbZBslQzl3Ff ou3O+/P8fo/2RiMAU/HMXZwfLJub9Ja1W8qFxJCryGr2qhB6W+3FBgCKvoNAd9s90fgJ szQrGZQZXs40nwAO6DEvC8Z+8srWfAawB73M/cSBAzZuLLjfKk7GVpz6d+S3JBJ/QtMF gb7JGuOglsipW4FXWDsszTYVDfpkC/m3l5iSF7a090YCJxXrNbO3mxQsz64mrFdC3dMF DiYg== X-Gm-Message-State: ABuFfoiRCOfwHm20EaSO+xZeAuNlVvycJnQif4hA9TYB34ddqwYUmG8Y UwBb+MIj4pe4exFevL0GdtwRyg8F X-Received: by 2002:aca:a94c:: with SMTP id s73-v6mr14624448oie.39.1538518816878; Tue, 02 Oct 2018 15:20:16 -0700 (PDT) Date: Tue, 2 Oct 2018 15:18:52 -0700 In-Reply-To: <20181002221903.19476-1-rkir@google.com> Message-Id: <20181002221903.19476-4-rkir@google.com> Mime-Version: 1.0 References: <20181002221903.19476-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH 04/15] platform: goldfish: pipe: Call misc_deregister if init fails From: rkir@google.com To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, tkjos@google.com, 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.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/goldfish/goldfish_pipe.c index 4013832f38fb..c386aaf40034 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -844,8 +844,10 @@ static int goldfish_pipe_device_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 @@ -858,6 +860,7 @@ static int goldfish_pipe_device_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.605.g01d371f741-goog