Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp2865668imm; Wed, 3 Oct 2018 10:18:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV63BAV5w/G90u0p5AXaTHzCz2lyOsoaqQd3eeJPiagrbfXR+tOD349Qg6VX/IcW6m+j+gpqD X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr2673107plb.264.1538587121303; Wed, 03 Oct 2018 10:18:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538587121; cv=none; d=google.com; s=arc-20160816; b=wMUIOpiuqaJyTBkQbxbEMfp8QKaia3JmMOaVPmmjvaSLO0QZY6qxDajlE2kcklRxXp cmkH+hYK8r8JxheA1TlOfYEdYvkfSWx9Y506YL5qO96FNv3aL3no2vrVegucr69Jh7o8 6sgBEy3JqZ89ZML34sVaY6mmrOSjFJGZKf2p17fF3q9OfH5LywtJAnXP8RANoB9JXkLQ Mz2v2nnp1OKIwfDDTreFSpVW1+5IYAgQqjN8/eyBEUSM/c+VyIo7bXAltfBfdnCfgxth j8BR3sHI/6C2ZCWIamlvQ22YPRJwXGI8MAU7/qClTZb7eH15Ui6PYAS0KXUXMm4wy/qQ W9Hw== 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=Q5rtQuIMje/HQHlwJtt1CDkAv2ZQ1kv74GtS4i5PJSA=; b=xvnFzTi4rhDsDYQGE/ael63H/Nm0rRFaRJ3wHd7o4aN6/qSK8Cw/UYUPo5N3YSFrv7 cX77zG/SndqHQK4PKr8fWu5obfzUXAm1FvmswMfT18kJIneqtJmkmPLJmkNNgszpTf8w NgdrsRIjMJEB9apb9xuyI+Lkl+gjrl3Q6oGKosFimtYPXqaU6YyJ+66+dg8bmmLnl1+u rBFa35YVyUqUzoLSn7fN2mHOA0bog7785uv2VTOpdHEuFLQ556vnVX/x5UMHgnAOBHxX nq3EXpyElEnEkNPGa0rdBBFay6sZryWbrw05sXLx/VeIuB3Ua6dSY/G1m2NMhSeQA2h8 Gvwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=bB3qf7Dq; 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 f89-v6si2354490plb.37.2018.10.03.10.18.18; Wed, 03 Oct 2018 10:18:41 -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=bB3qf7Dq; 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 S1727358AbeJDAHO (ORCPT + 99 others); Wed, 3 Oct 2018 20:07:14 -0400 Received: from mail-io1-f73.google.com ([209.85.166.73]:45581 "EHLO mail-io1-f73.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbeJDAHN (ORCPT ); Wed, 3 Oct 2018 20:07:13 -0400 Received: by mail-io1-f73.google.com with SMTP id g133-v6so6040932ioa.12 for ; Wed, 03 Oct 2018 10:17:56 -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=Q5rtQuIMje/HQHlwJtt1CDkAv2ZQ1kv74GtS4i5PJSA=; b=bB3qf7DqXQXaBOVYcWH0Jla6FU1WfmOYdQ9jM8Sl4LP9EDYenyIoT6A3MtaFbBZm0g gpJML4SXOZyl4k0rHTM1iPayLIMvYAaI9XIGr+hxh02p8fwRwOD45hugROxdW+0gVJqm I0dDe9rqNijIsJqjO818ayT2zP//JcxN7UXpgULwAwPuOa8C8z0mV1z5omwFeD5Gxg0r waB15P/EH+0kQTeHuGyLGE/A3iItgo6EiqNlDYzqVMLgpSeVYJMpLetOEhPpcCNY3+/A VwD0Pf12BM4v28sZQsmT7L7PlKiVTBScJChcU983dOCkHtsrnj1po3eqmqq5SdqnP+fW DGfg== 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=Q5rtQuIMje/HQHlwJtt1CDkAv2ZQ1kv74GtS4i5PJSA=; b=CErjzfGTE1dJc7wagibJGQ/StyCdrDK+Cd3fheLxaFbeXqE2wnvJk3S6DovUEbr2rV 7cwPmWnmEFNysQQal1ViWTHrkNpxVIEV5haSiSMvO1y2dSx0Os22tWOrbJUXWWRpnQGv VbPX63M4rBNgFr+PChMat9++TeZrggdrZ+E2L9xWYQuiMgKb7C51sjR3eU5THICQZFQS LkSjk4lymqqchFzKlsZmEsiitXqOJJJsoEJiwsmvonjxvfoeEdssoruX6FGDGVNf87/e P7Umv7E+EslW1B5+QTRjiyolrbycvGPSSKVelgmcDgNgLs8HeHt+HvK2DrQsWLcUJRLi awwg== X-Gm-Message-State: ABuFfoiRAPkXHvGYQs77DCS8Ug6wpMmtVt9YNxEpsd67PFLDi+M9Zpt3 zJj3Uzj9RZ4+VbmXhkMoQ9Nsd+Va X-Received: by 2002:a24:2443:: with SMTP id f64-v6mr2119375ita.27.1538587076030; Wed, 03 Oct 2018 10:17:56 -0700 (PDT) Date: Wed, 3 Oct 2018 10:17:09 -0700 In-Reply-To: <20181003171720.169953-1-rkir@google.com> Message-Id: <20181003171720.169953-4-rkir@google.com> Mime-Version: 1.0 References: <20181003171720.169953-1-rkir@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH v3 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 --- Changes in v3: - No change. Changes in v2: - No change. 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