From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) by ozlabs.org (Postfix) with ESMTP id 6EDFC140084 for ; Sat, 17 May 2014 04:23:39 +1000 (EST) Date: Fri, 16 May 2014 11:26:57 -0700 From: Greg KH To: Himangi Saraogi Subject: Re: question about hvc_opal.c Message-ID: <20140516182657.GA15475@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 In-Reply-To: Cc: linuxppc-dev@lists.ozlabs.org, jslaby@suse.cz, linux-kernel@vger.kernel.org, Julia Lawall List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, May 16, 2014 at 11:34:13PM +0530, Himangi Saraogi wrote: > Hi, >   > In function hvc_opal_probe I find : > >         hp = hvc_alloc(termno, 0, ops, MAX_VIO_PUT_CHARS); >         if (IS_ERR(hp)) >                 return PTR_ERR(hp); > > Earlier, hpc_opal_privs[termno] is assigned pv which is allocated using > kzalloc. Shouldn't there be a kfree(pv) and the array element (which is global) > be made NULL before the return. Also, if array element is set to NULL on the > failure, then some cleanup must be done to undo the effect of hvc_instantiate > as well. Please let me know if the change is desirable. Sounds reasonable, please send a patch.