From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753204AbbDGIt5 (ORCPT ); Tue, 7 Apr 2015 04:49:57 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:50040 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbbDGIty (ORCPT ); Tue, 7 Apr 2015 04:49:54 -0400 Date: Tue, 7 Apr 2015 11:49:30 +0300 From: Dan Carpenter To: Sudip Mukherjee Cc: Willy Tarreau , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: panel: remove duplicate code Message-ID: <20150407084930.GD10964@mwanda> References: <1428395101-20098-1-git-send-email-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1428395101-20098-1-git-send-email-sudipm.mukherjee@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 07, 2015 at 01:55:01PM +0530, Sudip Mukherjee wrote: > both the misc_deregister(), parport_release() and > parport_unregister_device() is there in the module_exit function also. > detach is called from parport_unregister_driver() and by the time > detach executes misc_deregister(), parport_release() and > parport_unregister_device() has already executed marking > keypad_initialized and lcd.initialized as false. so this part of the > code will never execute. > > Signed-off-by: Sudip Mukherjee Reviewed-by: Dan Carpenter A better subject might have been "remove dead code" but that was explained pretty well in the patch desription. I hadn't looked at this driver much before. It sucks that parport_driver ->attach() functions can't fail... I think we don't need the "keypad_initialized" and "lcd.initialized" variables because "if (pprt)" is enough to tell us whether or not the attach function succeeded. TODO: Staging: panel: remove some redundent variables. regards, dan carpenter