From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753177AbaKXJKK (ORCPT ); Mon, 24 Nov 2014 04:10:10 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:63750 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752790AbaKXJKI (ORCPT ); Mon, 24 Nov 2014 04:10:08 -0500 Date: Mon, 24 Nov 2014 10:10:03 +0100 From: Johan Hovold To: Julia Lawall Cc: SF Markus Elfring , Greg Kroah-Hartman , Johan Hovold , linux-usb@vger.kernel.org, LKML , kernel-janitors@vger.kernel.org Subject: Re: USB: serial: Deletion of an unnecessary check before the function call "release_firmware" Message-ID: <20141124091003.GA6875@localhost> References: <530CF8FF.8080600@users.sourceforge.net> <530DD06F.4090703@users.sourceforge.net> <5317A59D.4@users.sourceforge.net> <546F5831.5060404@users.sourceforge.net> <546F5ED7.1000206@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 21, 2014 at 06:59:00PM +0100, Julia Lawall wrote: > On Fri, 21 Nov 2014, SF Markus Elfring wrote: > > > >> diff --git a/drivers/usb/serial/mxuport.c b/drivers/usb/serial/mxuport.c > > >> index ab1d690..3653ec1 100644 > > >> --- a/drivers/usb/serial/mxuport.c > > >> +++ b/drivers/usb/serial/mxuport.c > > >> @@ -1101,8 +1101,7 @@ static int mxuport_probe(struct usb_serial *serial, > > >> */ > > >> usb_set_serial_data(serial, (void *)id->driver_info); > > >> out: > > >> - if (fw_p) > > >> - release_firmware(fw_p); > > >> + release_firmware(fw_p); > > > > > > I think that the if should stay. > > > > I have got an other opinion. > > > > > > > There were two cases on the allocation, so there should be two cases > > > on the release. > > > > I find that this implementation detail does not really matter for the > > necessity of a null pointer check directly before such a function call. > > Conceptually, if it is clear 10 lines above that nothing was allocated, > and there is a fallback to existing data (according to the comment above) > it is strange to be releasing something. I agree with Julia here and will not apply this one. Thanks, Johan