lkml.org 
[lkml]   [2012]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 3/3] drivers/mmc/host: Add realtek sdmmc interface driver
Date
On Thursday 19 July 2012 17:55:18 wei_wang@realsil.com.cn wrote:

> +static void sd_normal_rw(struct realtek_sdmmc *host, struct mmc_request *mrq)
> +{
> + struct mmc_command *cmd = mrq->cmd;
> + struct mmc_data *data = mrq->data;
> + u8 _cmd[5], *buf;
> +
> + _cmd[0] = 0x40 | (u8)cmd->opcode;
> + _cmd[1] = (u8)(cmd->arg >> 24);
> + _cmd[2] = (u8)(cmd->arg >> 16);
> + _cmd[3] = (u8)(cmd->arg >> 8);
> + _cmd[4] = (u8)cmd->arg;

Please use the predefined macro for endianness conversion.

> + buf = kzalloc(data->blksz, GFP_KERNEL);

1. You must handle a failure to allocate a buffer
2. You must use GFP_NOIO as you are in a block driver

Regards
Oliver



\
 
 \ /
  Last update: 2012-07-19 15:21    [W:0.048 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site