Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752040AbdFZOKX (ORCPT ); Mon, 26 Jun 2017 10:10:23 -0400 Received: from mail-ot0-f180.google.com ([74.125.82.180]:33590 "EHLO mail-ot0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751302AbdFZOKP (ORCPT ); Mon, 26 Jun 2017 10:10:15 -0400 MIME-Version: 1.0 In-Reply-To: References: <20170626093123.23838-1-orson.zhai@spreadtrum.com> From: Arnd Bergmann Date: Mon, 26 Jun 2017 16:10:14 +0200 X-Google-Sender-Auth: huAW5745rf_58-3l0gaBkh9agmQ Message-ID: Subject: =?UTF-8?B?UmU6IOetlOWkjTogW1JGQyBQQVRDSF0gY2hhcjogbWlzYzogSW5pdCBtaXNjLT5saXN0IA==?= =?UTF-8?B?aW4gYSBzYWZlIHdheQ==?= To: =?UTF-8?B?WmhvbmdwaW5nIFRhbiAo6LCt5Lit5bmzKQ==?= Cc: =?UTF-8?B?T3Jzb24gWmhhaSAo57+f5LqsKQ==?= , Greg Kroah-Hartman , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" 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 v5QEASTt027026 Content-Length: 580 Lines: 12 On Mon, Jun 26, 2017 at 4:00 PM, Zhongping Tan (谭中平) wrote: > hi Arnd: > Another way to describe this question, misc_register shouldn't modify the member of the miscdevice especially when return error. Let the caller to ensure the list have been initialized, > or when return error, please don't initialize the list. Why not? The caller should only initialize a couple of fields in the structure (name, minor, fops, ...) not never even look at the list entry, which is really internal to the misc_register()/misc_unregister(). Arnd