Re: [PATCH 2/2] Input: amikbd - Allocate temporary keymap buffer dynamically

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

 



Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> writes:

> @@ -147,13 +148,18 @@ static unsigned char amikbd_keycode[0x78] __initdata = {
>  
>  static void __init amikbd_init_console_keymaps(void)
>  {
> +	unsigned short *temp_map;
> +	size_t temp_map_size = NR_KEYS * sizeof(*temp_map);
>  	int i, j;
>  
> +	temp_map = kmalloc(temp_map_size, GFP_KERNEL);
> +	if (!temp_map)
> +		return;
> +
>  	for (i = 0; i < MAX_NR_KEYMAPS; i++) {
> -		static u_short temp_map[NR_KEYS] __initdata;
>  		if (!key_maps[i])
>  			continue;
> -		memset(temp_map, 0, sizeof(temp_map));
> +		memset(temp_map, 0, temp_map_size);
>  		for (j = 0; j < 0x78; j++) {
>  			if (!amikbd_keycode[j])
>  				continue;

How about allocating it on the stack?  With NR_KEYS == 256 that means
512 bytes, which should be ok, doesn't it?

Andreas.

-- 
Andreas Schwab, schwab@xxxxxxxxxxxxxx
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux