lkml.org 
[lkml]   [2010]   [Jun]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 5/5]scsi:hosts.c Fix warning: variable 'rval' set but not used
Date
Justin P. Mattock wrote:
> On 06/16/2010 08:34 AM, James Bottomley wrote:

> > However, I don't think we should be ignoring the fact that the eh thread
> > failed to spawn, so I think some type of printed warning (giving the
> > error code) would be a much more appropriate replacement.

> o.k. I'll give a try at that.. as a test I did this(below) seemed to
> compile clean, but not sure if this is what you're asking for though:

> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index 6660fa9..8d98a46 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -325,7 +325,6 @@ struct Scsi_Host *scsi_host_alloc(struct
> scsi_host_template *sht, int privsize)
> {
> struct Scsi_Host *shost;
> gfp_t gfp_mask = GFP_KERNEL;
> - int rval;
>
> if (sht->unchecked_isa_dma && privsize)
> gfp_mask |= __GFP_DMA;
> @@ -420,7 +419,7 @@ struct Scsi_Host *scsi_host_alloc(struct
> scsi_host_template *sht, int privsize)
> shost->ehandler = kthread_run(scsi_error_handler, shost,
> "scsi_eh_%d", shost->host_no);
> if (IS_ERR(shost->ehandler)) {
> - rval = PTR_ERR(shost->ehandler);
> + printk(KERN_WARNING "test.....\n");
> goto fail_kfree;
> }

If you want to print anything here I think the error code would be a good
thing to include as that could give a hint _what_ actually went wrong. In that
case you would need rval, but IMHO it should be declared inside that if
clause.

Eike
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2010-06-16 19:29    [W:1.033 / U:2.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site