From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:60590 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725940AbfGBInA (ORCPT ); Tue, 2 Jul 2019 04:43:00 -0400 Date: Tue, 2 Jul 2019 10:42:57 +0200 From: Cornelia Huck Subject: Re: [RFC v1 2/4] vfio-ccw: No need to call cp_free on an error in cp_init Message-ID: <20190702104257.102f32d3.cohuck@redhat.com> In-Reply-To: <5f1b69cd3a52e367f9f5014a3613768c8634408c.1561997809.git.alifm@linux.ibm.com> References: <5f1b69cd3a52e367f9f5014a3613768c8634408c.1561997809.git.alifm@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: Farhan Ali Cc: farman@linux.ibm.com, pasic@linux.ibm.com, linux-s390@vger.kernel.org, kvm@vger.kernel.org On Mon, 1 Jul 2019 12:23:44 -0400 Farhan Ali wrote: > We don't set cp->initialized to true so calling cp_free > will just return and not do anything. > > Signed-off-by: Farhan Ali > --- > drivers/s390/cio/vfio_ccw_cp.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c > index 5ac4c1e..cab1be9 100644 > --- a/drivers/s390/cio/vfio_ccw_cp.c > +++ b/drivers/s390/cio/vfio_ccw_cp.c > @@ -647,8 +647,6 @@ int cp_init(struct channel_program *cp, struct device *mdev, union orb *orb) > > /* Build a ccwchain for the first CCW segment */ > ret = ccwchain_handle_ccw(orb->cmd.cpa, cp); > - if (ret) > - cp_free(cp); Makes sense; hopefully ccwchain_handle_ccw() cleans up correctly on error :) (I think it does) Maybe add a comment /* ccwchain_handle_ccw() already cleans up on error */ so we don't stumble over this in the future? (Also, does this want a Fixes: tag?) > > if (!ret) > cp->initialized = true;