Re: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check

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

 



On Fri, Nov 08, 2013 at 12:24:49AM -0800, Dan Carpenter wrote:
> Date: Fri, 8 Nov 2013 00:24:49 -0800 (PST)
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> To: Len Brown <lenb@xxxxxxxxxx>, "Chen, Gong" <gong.chen@xxxxxxxxxxxxxxx>
> Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>, linux-acpi@xxxxxxxxxxxxxxx,
>  Tony Luck <tony.luck@xxxxxxxxx>, kernel-janitors@xxxxxxxxxxxxxxx
> Subject: [patch 2/2 v2] ACPI, extlog: remove unneeded NULL check
> USER-AGENT: Mutt/1.5.21 (2010-09-15)
> 
> We dereference extlog_l1_addr before checking if is NULL.  It turns out
> "extlog_l1_addr" pointer can never be NULL when this function is called
> so I have removed the check.
> 
> We can remove the "elog_addr" check as well.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
> v2: remove the elog_addr check as well.
> 
> diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
> index a6869e1..17da458 100644
> --- a/drivers/acpi/acpi_extlog.c
> +++ b/drivers/acpi/acpi_extlog.c
> @@ -310,10 +310,8 @@ static void __exit extlog_exit(void)
>  {
>  	mce_unregister_decode_chain(&extlog_mce_dec);
>  	((struct extlog_l1_head *)extlog_l1_addr)->flags &= ~FLAG_OS_OPTIN;
> -	if (extlog_l1_addr)
> -		acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> -	if (elog_addr)
> -		acpi_os_unmap_memory(elog_addr, elog_size);
> +	acpi_os_unmap_memory(extlog_l1_addr, l1_size);
> +	acpi_os_unmap_memory(elog_addr, elog_size);
>  	release_mem_region(elog_base, elog_size);
>  	release_mem_region(l1_dirbase, l1_size);
>  	kfree(elog_buf);

Signed-off-by: Chen, Gong <gong.chen@xxxxxxxxxxxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux