RE: [PATCH 09/14] Big kfree NULL check cleanup - misc remaining drivers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Jesper Juhl [mailto:[email protected]] 
> This is the remaining misc drivers/ part of the big kfree 
> cleanup patch.
> 
> Remove pointless checks for NULL prior to calling kfree() in 
> misc files in drivers/.
> 
>  
> --- linux-2.6.14-rc4-orig/drivers/block/cciss.c	
> 2005-10-11 22:41:05.000000000 +0200
> +++ linux-2.6.14-rc4/drivers/block/cciss.c	2005-10-12 
> 17:43:18.000000000 +0200
> @@ -1096,14 +1096,11 @@ static int cciss_ioctl(struct inode *ino
>  cleanup1:
>  		if (buff) {
>  			for(i=0; i<sg_used; i++)
> -				if(buff[i] != NULL)
> -					kfree(buff[i]);

I'm not sure I agree that these are pointless checks. They're not in the
main code path so nothing is lost by checking first. What if the pointer
is NULL????

Anybody else?

mikem


> +				kfree(buff[i]);
>  			kfree(buff);
>  		}
> -		if (buff_size)
> -			kfree(buff_size);
> -		if (ioc)
> -			kfree(ioc);
> +		kfree(buff_size);
> +		kfree(ioc);
>  		return(status);
>  	}
>  	default:
> @@ -3034,8 +3031,7 @@ static int __devinit cciss_init_one(stru
>  	return(1);
>  
>  clean4:
> -	if(hba[i]->cmd_pool_bits)
> -               	kfree(hba[i]->cmd_pool_bits);
> +	kfree(hba[i]->cmd_pool_bits);
>  	if(hba[i]->cmd_pool)
>  		pci_free_consistent(hba[i]->pdev,
>  			NR_CMDS * sizeof(CommandList_struct),
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux