2010-08-02 09:23:30

by Tao Ma

[permalink] [raw]
Subject: [PATCH] ide: Use kzalloc in idedisk_prepare_flush.

Signed-off-by: Tao Ma <[email protected]>
---
drivers/ide/ide-disk.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 33d6503..127a5a2 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -430,12 +430,11 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
{
ide_drive_t *drive = q->queuedata;
- struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+ struct ide_cmd *cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);

/* FIXME: map struct ide_taskfile on rq->cmd[] */
BUG_ON(cmd == NULL);

- memset(cmd, 0, sizeof(*cmd));
if (ata_id_flush_ext_enabled(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
cmd->tf.command = ATA_CMD_FLUSH_EXT;
--
1.7.1.571.gba4d01


2010-08-02 16:10:45

by FUJITA Tomonori

[permalink] [raw]
Subject: Re: [PATCH] ide: Use kzalloc in idedisk_prepare_flush.

On Mon, 2 Aug 2010 17:22:31 +0800
Tao Ma <[email protected]> wrote:

> Signed-off-by: Tao Ma <[email protected]>
> ---
> drivers/ide/ide-disk.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
> index 33d6503..127a5a2 100644
> --- a/drivers/ide/ide-disk.c
> +++ b/drivers/ide/ide-disk.c
> @@ -430,12 +430,11 @@ static void ide_disk_unlock_native_capacity(ide_drive_t *drive)
> static void idedisk_prepare_flush(struct request_queue *q, struct request *rq)
> {
> ide_drive_t *drive = q->queuedata;
> - struct ide_cmd *cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
> + struct ide_cmd *cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);
>
> /* FIXME: map struct ide_taskfile on rq->cmd[] */
> BUG_ON(cmd == NULL);
>
> - memset(cmd, 0, sizeof(*cmd));

This change conflicts with the change in linux-next (came from Jens'
tree).

2010-08-03 02:08:38

by Tao Ma

[permalink] [raw]
Subject: [PATCH v2] ide: Use kzalloc in idedisk_prep_fn.

>
> This change conflicts with the change in linux-next (came from Jens'
> tree).
Thanks for pointing it out. Here is the updated one.

Regards,
Tao

>From 5b8ae2eb7e3ecb54ea8db3b296727106148f17b3 Mon Sep 17 00:00:00 2001
From: Tao Ma <[email protected]>
Date: Tue, 3 Aug 2010 08:18:27 +0800
Subject: [PATCH v2] ide: Use kzalloc in idedisk_prep_fn.

Signed-off-by: Tao Ma <[email protected]>
Cc: FUJITA Tomonori <[email protected]>
---
drivers/ide/ide-disk.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c
index 7433e07..471bb0d 100644
--- a/drivers/ide/ide-disk.c
+++ b/drivers/ide/ide-disk.c
@@ -435,12 +435,11 @@ static int idedisk_prep_fn(struct request_queue *q, struct request *rq)
if (!(rq->cmd_flags & REQ_FLUSH))
return BLKPREP_OK;

- cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+ cmd = kzalloc(sizeof(*cmd), GFP_ATOMIC);

/* FIXME: map struct ide_taskfile on rq->cmd[] */
BUG_ON(cmd == NULL);

- memset(cmd, 0, sizeof(*cmd));
if (ata_id_flush_ext_enabled(drive->id) &&
(drive->capacity64 >= (1UL << 28)))
cmd->tf.command = ATA_CMD_FLUSH_EXT;
--
1.7.1.571.gba4d01