Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8091e0ca authored by Kris Borer's avatar Kris Borer Committed by Greg Kroah-Hartman
Browse files

USB: rewrite isd200_init_info for readability



Previously, Coccinelle would issue the following false positive:

isd200.c:1478:14-18: ERROR: reference preceded by free on line 1472

This change rewrites the isd200_init_info function to have more explicit
execution pathways to make it easier for scripts and humans to parse.

Signed-off-by: default avatarKris Borer <kborer@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d0452fe0
Loading
Loading
Loading
Loading
+13 −17
Original line number Original line Diff line number Diff line
@@ -1456,30 +1456,26 @@ static void isd200_free_info_ptrs(void *info_)
 */
 */
static int isd200_init_info(struct us_data *us)
static int isd200_init_info(struct us_data *us)
{
{
	int retStatus = ISD200_GOOD;
	struct isd200_info *info;
	struct isd200_info *info;


	info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
	info = kzalloc(sizeof(struct isd200_info), GFP_KERNEL);
	if (!info)
	if (!info)
		retStatus = ISD200_ERROR;
		return ISD200_ERROR;
	else {

	info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
	info->id = kzalloc(ATA_ID_WORDS * 2, GFP_KERNEL);
	info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
	info->RegsBuf = kmalloc(sizeof(info->ATARegs), GFP_KERNEL);
		info->srb.sense_buffer =
	info->srb.sense_buffer = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
				kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);

	if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) {
	if (!info->id || !info->RegsBuf || !info->srb.sense_buffer) {
		isd200_free_info_ptrs(info);
		isd200_free_info_ptrs(info);
		kfree(info);
		kfree(info);
			retStatus = ISD200_ERROR;
		return ISD200_ERROR;
		}
	}
	}


	if (retStatus == ISD200_GOOD) {
	us->extra = info;
	us->extra = info;
	us->extra_destructor = isd200_free_info_ptrs;
	us->extra_destructor = isd200_free_info_ptrs;
	}


	return retStatus;
	return ISD200_GOOD;
}
}


/**************************************************************************
/**************************************************************************