From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753092AbdBCKSJ (ORCPT ); Fri, 3 Feb 2017 05:18:09 -0500 Received: from mail-ve1eur01on0070.outbound.protection.outlook.com ([104.47.1.70]:20271 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753040AbdBCKSH (ORCPT ); Fri, 3 Feb 2017 05:18:07 -0500 From: Laurentiu Tudor To: Greg KH CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "agraf@suse.de" , "arnd@arndb.de" , "Ioana Ciornei" , Ruxandra Ioana Radulescu , Bharat Bhushan , "Stuart Yoder" , Catalin Horghidan , Leo Li , Roy Pledge Subject: Re: [PATCH 2/9] staging: fsl-mc: fix device ref counting Thread-Topic: [PATCH 2/9] staging: fsl-mc: fix device ref counting Thread-Index: AQHSfIBzn6cHywK69Eu5DyzkjLuVDKFXDqaAgAAF5YA= Date: Fri, 3 Feb 2017 10:17:53 +0000 Message-ID: <589458CF.90804@nxp.com> References: <20170201114329.21276-1-laurentiu.tudor@nxp.com> <20170201114329.21276-3-laurentiu.tudor@nxp.com> <20170203095645.GE24767@kroah.com> In-Reply-To: <20170203095645.GE24767@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [192.88.146.1] x-microsoft-exchange-diagnostics: 1;VI1PR0401MB2272;7:nhYa/sbB0czA/EZDgb3Q9EEhHFWQUgsdmTB35ijmq0Wp1SU0N9aYIINQzmOjNdpdci6khEXyeLxsFgPX65hn1OklZ4uFWzkyyUl4SGiAoMvcMpzhyXYxQqCf+tUMlPo7UI+gXwxeDkHwjkIMv7Ypjkf+HtgU/GZka7qVLZvkpfTaDGsKHZAtosTh1khRxPe25wpwlgsdq96S+B+75q9s2oQSpBdbYzkCbqpDeGqR7EUeaOexetVmFO9UtJflwuMUgnGey+0yXbjiHcoiGFdG+Xl1QAYAXIIHGfDiF1bkuNpCk2Rph0BjmpIp7Qjjp71QO1cyA4qwzfPvx4GcodjbByRORPnVsWCSjsOFj/z4o607cJoY0qx39S+x4N7z+I0aSoSUSeOkGxmo5gbGDrS33D6yROkSrW5gYi4l54MPgZSy1BCDYLBvO6ZjYoxSSzjVZzdREYchlt9ICyRoKQbqESraacBsknA4geN1kHtLx+nVEhyWjwQW37Y6lWwgiL7PGD3FEzAfsKAYyq2TtaxiFw== x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(6009001)(7916002)(39860400002)(39840400002)(39450400003)(39850400002)(39410400002)(24454002)(199003)(189002)(377454003)(101416001)(2950100002)(122556002)(66066001)(76176999)(2906002)(6512007)(81166006)(54906002)(81156014)(50986999)(54356999)(6506006)(38730400001)(2900100001)(65816999)(53936002)(92566002)(86362001)(110136003)(5660300001)(77096006)(8676002)(6486002)(106116001)(229853002)(99286003)(105586002)(68736007)(106356001)(102836003)(53546003)(6436002)(6916009)(97736004)(7736002)(33656002)(8936002)(25786008)(189998001)(6116002)(3280700002)(6246003)(4326007)(3660700001)(3846002)(36756003)(305945005);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2272;H:VI1PR0401MB1856.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; x-ms-office365-filtering-correlation-id: c50fdecd-6a1a-453b-506e-08d44c1dea3c x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(48565401081);SRVR:VI1PR0401MB2272; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123562025)(20161123560025)(20161123564025)(20161123555025)(6072148);SRVR:VI1PR0401MB2272;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0401MB2272; x-forefront-prvs: 02070414A1 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="Windows-1252" Content-ID: <38570271D7213C4FB7EF6547024AE6D2@eurprd04.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Feb 2017 10:17:53.0894 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2272 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v13AITxk020198 Hi Greg, Thanks for having a look. Comment below. On 02/03/2017 11:56 AM, Greg KH wrote: > On Wed, Feb 01, 2017 at 05:43:22AM -0600, laurentiu.tudor@nxp.com wrote: >> From: Laurentiu Tudor >> >> Drop unneeded get_device() call at device creation >> and, as per documentation, drop reference count >> after using device_find_child() return. >> >> Signed-off-by: Laurentiu Tudor >> --- >> drivers/staging/fsl-mc/bus/dprc-driver.c | 1 + >> drivers/staging/fsl-mc/bus/fsl-mc-bus.c | 1 - >> 2 files changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c >> index 4e416d8..e4b0341 100644 >> --- a/drivers/staging/fsl-mc/bus/dprc-driver.c >> +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c >> @@ -188,6 +188,7 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, >> child_dev = fsl_mc_device_lookup(obj_desc, mc_bus_dev); >> if (child_dev) { >> check_plugged_state_change(child_dev, obj_desc); >> + put_device(&child_dev->dev); >> continue; >> } >> >> diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c >> index cc20dc4..7c6a43b 100644 >> --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c >> +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c >> @@ -537,7 +537,6 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc, >> goto error_cleanup_dev; >> } >> >> - (void)get_device(&mc_dev->dev); > > This implies that your device reference counting is totally wrong and > messed up. Does this fix anything? Break anything? It should do > something different now... It fixes the refcounting in the sense that I'm now seeing the error that i think you were referring to in your previous reviews, when we hot unplug a device: "Device 'foo.N' does not have a release() function, it is broken and must be fixed." See next patch that adds the required callback. Regarding this particular get_device(), i have no clue why the original author placed it here. I've looked over other bus implementations and didn't see something similar. --- Best Regards, Laurentiu