[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240625093928.9210-F-hca@linux.ibm.com>
Date: Tue, 25 Jun 2024 11:39:28 +0200
From: Heiko Carstens <hca@...ux.ibm.com>
To: Yunseong Kim <yskelg@...il.com>
Cc: Harald Freudenberger <freude@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Markus Elfring <Markus.Elfring@....de>,
MichelleJin <shjy180909@...il.com>, linux-s390@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] s390/raw3270: Handle memory allocation failures in
raw3270_setup_console()
On Tue, Jun 25, 2024 at 04:44:47PM +0900, Yunseong Kim wrote:
> Hi Heiko,
> >> - set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags);
> >> -
> >> + }
> >> rc = ccw_device_enable_console(cdev);
> >> if (rc) {
> >> ccw_device_destroy_console(cdev);
> >> + kfree(ascebc);
> >> + kfree(rp);
> >> return ERR_PTR(rc);
> >> }
> >> + set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags);
> >
> > Why did you move the set_bit() call?
>
> Thank you for the code review Heiko.
>
> While writing patch version 2, I spent a lot of time thinking about this
> part. Previously, even if function "ccw_device_enable_console" failed,
> the flag was set to RAW3270_FLAGS_CONSOLE and returned.
>
> I think it would be more appropriate to set the bit after everything
> succeeded, so I included and submitted this code in v2 patch.
>
> I’d appreciate hearing your thoughts on this!
"More appropriate" is not a technical reason. Please don't mix
different things into a single patch. If the set_bit() call needs to
be moved then you need to provide a technical reason for it.
Powered by blists - more mailing lists