* [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver
[not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
@ 2007-08-24 0:12 ` Jesper Juhl
2007-08-24 7:04 ` Rolf Eike Beer
2007-08-24 0:16 ` [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values Jesper Juhl
1 sibling, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2007-08-24 0:12 UTC (permalink / raw)
To: Linux Kernel Mailing List
Cc: linux-scsi, James Bottomley, Willem Riede, osst-users,
Jesper Juhl
[kv]alloc() return void *. No need to cast the return value.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/scsi/osst.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 08060fb..3ad9d49 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -1404,7 +1404,7 @@ static int osst_read_back_buffer_and_rewrite(struct osst_tape * STp, struct osst
int dbg = debugging;
#endif
- if ((buffer = (unsigned char *)vmalloc((nframes + 1) * OS_DATA_SIZE)) == NULL)
+ if ((buffer = vmalloc((nframes + 1) * OS_DATA_SIZE)) == NULL)
return (-EIO);
printk(KERN_INFO "%s:I: Reading back %d frames from drive buffer%s\n",
@@ -2216,7 +2216,7 @@ static int osst_write_header(struct osst_tape * STp, struct osst_request ** aSRp
if (STp->raw) return 0;
if (STp->header_cache == NULL) {
- if ((STp->header_cache = (os_header_t *)vmalloc(sizeof(os_header_t))) == NULL) {
+ if ((STp->header_cache = vmalloc(sizeof(os_header_t))) == NULL) {
printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name);
return (-ENOMEM);
}
@@ -2404,7 +2404,7 @@ static int __osst_analyze_headers(struct osst_tape * STp, struct osst_request **
name, ppos, update_frame_cntr);
#endif
if (STp->header_cache == NULL) {
- if ((STp->header_cache = (os_header_t *)vmalloc(sizeof(os_header_t))) == NULL) {
+ if ((STp->header_cache = vmalloc(sizeof(os_header_t))) == NULL) {
printk(KERN_ERR "%s:E: Failed to allocate header cache\n", name);
return 0;
}
@@ -5756,7 +5756,7 @@ static int osst_probe(struct device *dev)
write_lock(&os_scsi_tapes_lock);
if (os_scsi_tapes == NULL) {
os_scsi_tapes =
- (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *),
+ kmalloc(osst_max_dev * sizeof(struct osst_tape *),
GFP_ATOMIC);
if (os_scsi_tapes == NULL) {
write_unlock(&os_scsi_tapes_lock);
--
1.5.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values
[not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
2007-08-24 0:12 ` [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver Jesper Juhl
@ 2007-08-24 0:16 ` Jesper Juhl
2007-08-24 2:03 ` Matthew Wilcox
1 sibling, 1 reply; 6+ messages in thread
From: Jesper Juhl @ 2007-08-24 0:16 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: linux-scsi, James Bottomley, linux, Jesper Juhl
There's no reason to cast void pointers returned by the generic
memory allocation functions.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
drivers/scsi/advansys.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 79c0b6e..b28729c 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -18513,7 +18513,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
* Allocate buffer carrier structures. The total size
* is about 4 KB, so allocate all at once.
*/
- carrp = (ADV_CARR_T *) kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC);
+ carrp = kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC);
ASC_DBG1(1, "advansys_board_found: carrp 0x%lx\n", (ulong)carrp);
if (carrp == NULL) {
@@ -18529,8 +18529,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
for (req_cnt = adv_dvc_varp->max_host_qng;
req_cnt > 0; req_cnt--) {
- reqp = (adv_req_t *)
- kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC);
+ reqp = kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC);
ASC_DBG3(1,
"advansys_board_found: reqp 0x%lx, req_cnt %d, bytes %lu\n",
@@ -18552,9 +18551,7 @@ advansys_board_found(int iop, struct device *dev, int bus_type)
boardp->adv_sgblkp = NULL;
for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
- sgp = (adv_sgblk_t *)
- kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
-
+ sgp = kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
if (sgp == NULL) {
break;
}
--
1.5.2.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values
2007-08-24 0:16 ` [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values Jesper Juhl
@ 2007-08-24 2:03 ` Matthew Wilcox
2007-08-24 9:00 ` Jesper Juhl
0 siblings, 1 reply; 6+ messages in thread
From: Matthew Wilcox @ 2007-08-24 2:03 UTC (permalink / raw)
To: Jesper Juhl; +Cc: Linux Kernel Mailing List, linux-scsi, James Bottomley, linux
On Fri, Aug 24, 2007 at 02:16:12AM +0200, Jesper Juhl wrote:
> There's no reason to cast void pointers returned by the generic
> memory allocation functions.
I think I fixed all these already; please check scsi-misc.
--
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver
2007-08-24 0:12 ` [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver Jesper Juhl
@ 2007-08-24 7:04 ` Rolf Eike Beer
2007-08-24 8:46 ` Jesper Juhl
0 siblings, 1 reply; 6+ messages in thread
From: Rolf Eike Beer @ 2007-08-24 7:04 UTC (permalink / raw)
To: linux-scsi
Cc: Jesper Juhl, Linux Kernel Mailing List, James Bottomley,
Willem Riede, osst-users
[-- Attachment #1: Type: text/plain, Size: 658 bytes --]
Jesper Juhl wrote:
> [kv]alloc() return void *. No need to cast the return value.
> @@ -5756,7 +5756,7 @@ static int osst_probe(struct device *dev)
> write_lock(&os_scsi_tapes_lock);
> if (os_scsi_tapes == NULL) {
> os_scsi_tapes =
> - (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> + kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> GFP_ATOMIC);
> if (os_scsi_tapes == NULL) {
> write_unlock(&os_scsi_tapes_lock);
Three lines later:
for (i=0; i < osst_max_dev; ++i) os_scsi_tapes[i] = NULL;
This wants to be
os_scsi_tapes = kcalloc(osst_max_dev, sizeof(struct osst_tape *), GFP_ATOMIC);
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver
2007-08-24 7:04 ` Rolf Eike Beer
@ 2007-08-24 8:46 ` Jesper Juhl
0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2007-08-24 8:46 UTC (permalink / raw)
To: Rolf Eike Beer
Cc: linux-scsi, Linux Kernel Mailing List, James Bottomley,
Willem Riede, osst-users
On 24/08/07, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
> Jesper Juhl wrote:
> > [kv]alloc() return void *. No need to cast the return value.
>
> > @@ -5756,7 +5756,7 @@ static int osst_probe(struct device *dev)
> > write_lock(&os_scsi_tapes_lock);
> > if (os_scsi_tapes == NULL) {
> > os_scsi_tapes =
> > - (struct osst_tape **)kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> > + kmalloc(osst_max_dev * sizeof(struct osst_tape *),
> > GFP_ATOMIC);
> > if (os_scsi_tapes == NULL) {
> > write_unlock(&os_scsi_tapes_lock);
>
> Three lines later:
>
> for (i=0; i < osst_max_dev; ++i) os_scsi_tapes[i] = NULL;
>
> This wants to be
>
> os_scsi_tapes = kcalloc(osst_max_dev, sizeof(struct osst_tape *), GFP_ATOMIC);
>
Thank you for pointing that out.
I plan to resend those patches that don't get picked up in about a
week or so. I'll address this issue then (or if it does get picked up
in its current form I'll submit a follow-on patch to address this).
> Eike
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values
2007-08-24 2:03 ` Matthew Wilcox
@ 2007-08-24 9:00 ` Jesper Juhl
0 siblings, 0 replies; 6+ messages in thread
From: Jesper Juhl @ 2007-08-24 9:00 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Linux Kernel Mailing List, linux-scsi, James Bottomley, linux
On 24/08/07, Matthew Wilcox <matthew@wil.cx> wrote:
> On Fri, Aug 24, 2007 at 02:16:12AM +0200, Jesper Juhl wrote:
> > There's no reason to cast void pointers returned by the generic
> > memory allocation functions.
>
> I think I fixed all these already; please check scsi-misc.
>
I just checked out the latest scsi-misc-2.6 tree and it does indeed
look like these have already been dealt with.
Sorry about the noise.
--
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-08-24 9:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1554af80879a7ef2f78a4d654f23c248203500d9.1187912217.git.jesper.juhl@gmail.com>
2007-08-24 0:12 ` [PATCH 19/30] scsi: Remove explicit casts of [kv]alloc return values in osst driver Jesper Juhl
2007-08-24 7:04 ` Rolf Eike Beer
2007-08-24 8:46 ` Jesper Juhl
2007-08-24 0:16 ` [PATCH 20/30] scsi: In the Advansys driver, do not cast allocation function return values Jesper Juhl
2007-08-24 2:03 ` Matthew Wilcox
2007-08-24 9:00 ` Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox