From patchwork Wed Mar 7 11:03:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arvind Yadav X-Patchwork-Id: 10263781 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 68BD3602C8 for ; Wed, 7 Mar 2018 11:04:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C020294B9 for ; Wed, 7 Mar 2018 11:04:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 504DC294C5; Wed, 7 Mar 2018 11:04:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E62D9294B9 for ; Wed, 7 Mar 2018 11:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754385AbeCGLE1 (ORCPT ); Wed, 7 Mar 2018 06:04:27 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:53366 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751284AbeCGLEG (ORCPT ); Wed, 7 Mar 2018 06:04:06 -0500 Received: by mail-it0-f65.google.com with SMTP id w63so2808654ita.3; Wed, 07 Mar 2018 03:04:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=gDCA9wcXo5LjuGUbBrauuqejlGYybnPO312viv97MNI=; b=XbsKt3ak74329+VCOUf72zAINvsBYAiQUJ+RL5A3n8cRyszqAml3e7l5Gr7MraMNdd Rt0CQgyXV+KJeRo4Gys1qCFuKZEVgl9tlu7JxFddw1e2MNhKyhJOC1zD4L0KbBJL5F5g Rp2toei9aEnp5UFMHf04zLNUcCqy1raYi577NSQsI41SfFY95sOmvnuye5ax65KdcyNq vgQd2JYGdAR/8tRmVfp+VA2cuSbv34kj5+fXunj9HPvki6iT14ZNDprMiSeIaPoBfMNB T+/Ek05cRrmv23o5so3r10gG72t3UnKKA9qGmPnS1dEUiMpyqHO23J7R4Tvu8dMJKV+H xIQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=gDCA9wcXo5LjuGUbBrauuqejlGYybnPO312viv97MNI=; b=ZsabULFh5SBgfRJKAd8ftebMihLam+2riG/SrLVGye5UzceotBhiQOfaY9jjiz3rYI Mqu+8nRc5qrPAnh2OO53nZkPM2a9gCnYez5ulC+71zA+JAYyh39yBlp/KvieXyKb2vVw 6TGsbedbkvjdY/TlL3kXi3Z0g43UuBlRbSsq6ux0++cKEAPApm2znmFD08BDK3BcMCri GG9av5Lgya62hvvBuTNAUHouVQl44ShjMacK3s5iJv5tDS/Rpi7wszQZs6+obA3LLA7o Ir/0JtARLxjwKZJLITlSUSE+F/09pS6EEBTclBHFmAwZ7t+YqIFZ7Dz+LjwKdsPBqn1X bQwA== X-Gm-Message-State: AElRT7HLbiykJ5kiN4rkcJMVwY4g2PqVksvbE6fU2LjsaDwCrSuSOHR6 H8ky0dlJYs3ET7DT2G+dpSJzhQ== X-Google-Smtp-Source: AG47ELuNYBCTz0BAXd8ZMCOym/c9bKqbZM5tHhle87sg3tzgCDbyVT4b0/JJbHqEZAtIrEAAijuqkg== X-Received: by 10.36.65.21 with SMTP id x21mr22489070ita.146.1520420645412; Wed, 07 Mar 2018 03:04:05 -0800 (PST) Received: from symbol-HP-Z420-Workstation.zebra.lan ([149.23.17.254]) by smtp.googlemail.com with ESMTPSA id l123sm8654136itl.43.2018.03.07.03.04.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Mar 2018 03:04:04 -0800 (PST) From: Arvind Yadav To: ysato@users.sourceforge.jp, dalias@libc.org Cc: linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org Subject: [PATCH 1/2] sh: maple: use put_device() instead of kfree() Date: Wed, 7 Mar 2018 16:33:13 +0530 Message-Id: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav --- drivers/sh/maple/maple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c index 7525039..28674fe 100644 --- a/drivers/sh/maple/maple.c +++ b/drivers/sh/maple/maple.c @@ -393,7 +393,7 @@ static void maple_attach_driver(struct maple_device *mdev) dev_warn(&mdev->dev, "could not register device at" " (%d, %d), with error 0x%X\n", mdev->unit, mdev->port, error); - maple_free_dev(mdev); + put_device(&mdev->dev); mdev = NULL; return; } @@ -886,6 +886,7 @@ static int __init maple_bus_init(void) cleanup: printk(KERN_ERR "Maple bus registration failed\n"); + put_device(&maple_bus); return retval; } /* Push init to later to ensure hardware gets detected */