All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Lu <aaron.lu@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
Date: Sat, 19 May 2012 03:38:21 +0000	[thread overview]
Message-ID: <20120519033821.GA2425@localhost.localdomain> (raw)
In-Reply-To: <2FB252790F768E479D722B6F9B6D68C4B03E50@SCYBEXDAG02.amd.com>

> From: Dan Carpenter [dan.carpenter@oracle.com]
> To: James E.J. Bottomley; Lu, Aaron
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Alan Stern
> Subject: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
> 
> This gets caught by GCC:
> drivers/scsi/scsi_pm.c:30:5: warning: passing argument 1 of
>         ‘scsi_device_resume’ from incompatible pointer type
>         [enabled by default]

Thanks for pointing this out.
I've posted v2 the other day and James is aware of this already:
http://marc.info/?l=linux-scsi&m\x133706440112890&w=2

> 
> It probably would have been caught in testing as well, but it's on an
> error path.

I'm dealing with such error so developed this patch. But there are other
changes too in my code, so I prepared this patch in another clean repo
and made the mistake, sorry for not testing it before submit. 

-Aaron

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I haven't tested this.  :/  Sorry for that.
> 
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index 9bd2c41..d4201de 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -27,7 +27,7 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
>                 if (drv && drv->suspend) {
>                         err = drv->suspend(dev, msg);
>                         if (err)
> -                               scsi_device_resume(dev);
> +                               scsi_device_resume(to_scsi_device(dev));
>                 }
>         }
>         dev_dbg(dev, "scsi suspend: %d\n", err);
> 

WARNING: multiple messages have this Message-ID (diff)
From: Aaron Lu <aaron.lu@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
Date: Sat, 19 May 2012 11:38:21 +0800	[thread overview]
Message-ID: <20120519033821.GA2425@localhost.localdomain> (raw)
In-Reply-To: <2FB252790F768E479D722B6F9B6D68C4B03E50@SCYBEXDAG02.amd.com>

> From: Dan Carpenter [dan.carpenter@oracle.com]
> To: James E.J. Bottomley; Lu, Aaron
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Alan Stern
> Subject: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
> 
> This gets caught by GCC:
> drivers/scsi/scsi_pm.c:30:5: warning: passing argument 1 of
>         ‘scsi_device_resume’ from incompatible pointer type
>         [enabled by default]

Thanks for pointing this out.
I've posted v2 the other day and James is aware of this already:
http://marc.info/?l=linux-scsi&m=133706440112890&w=2

> 
> It probably would have been caught in testing as well, but it's on an
> error path.

I'm dealing with such error so developed this patch. But there are other
changes too in my code, so I prepared this patch in another clean repo
and made the mistake, sorry for not testing it before submit. 

-Aaron

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I haven't tested this.  :/  Sorry for that.
> 
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index 9bd2c41..d4201de 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -27,7 +27,7 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
>                 if (drv && drv->suspend) {
>                         err = drv->suspend(dev, msg);
>                         if (err)
> -                               scsi_device_resume(dev);
> +                               scsi_device_resume(to_scsi_device(dev));
>                 }
>         }
>         dev_dbg(dev, "scsi suspend: %d\n", err);
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Aaron Lu <aaron.lu@amd.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org, Aaron Lu <aaron.lwe@gmail.com>
Subject: Re: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
Date: Sat, 19 May 2012 11:38:21 +0800	[thread overview]
Message-ID: <20120519033821.GA2425@localhost.localdomain> (raw)
In-Reply-To: <2FB252790F768E479D722B6F9B6D68C4B03E50@SCYBEXDAG02.amd.com>

> From: Dan Carpenter [dan.carpenter@oracle.com]
> To: James E.J. Bottomley; Lu, Aaron
> Cc: linux-scsi@vger.kernel.org; linux-kernel@vger.kernel.org; kernel-janitors@vger.kernel.org; Alan Stern
> Subject: [patch] [SCSI] scsi_pm: passing wrong pointer to resume()
> 
> This gets caught by GCC:
> drivers/scsi/scsi_pm.c:30:5: warning: passing argument 1 of
>         ‘scsi_device_resume’ from incompatible pointer type
>         [enabled by default]

Thanks for pointing this out.
I've posted v2 the other day and James is aware of this already:
http://marc.info/?l=linux-scsi&m=133706440112890&w=2

> 
> It probably would have been caught in testing as well, but it's on an
> error path.

I'm dealing with such error so developed this patch. But there are other
changes too in my code, so I prepared this patch in another clean repo
and made the mistake, sorry for not testing it before submit. 

-Aaron

> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I haven't tested this.  :/  Sorry for that.
> 
> diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
> index 9bd2c41..d4201de 100644
> --- a/drivers/scsi/scsi_pm.c
> +++ b/drivers/scsi/scsi_pm.c
> @@ -27,7 +27,7 @@ static int scsi_dev_type_suspend(struct device *dev, pm_message_t msg)
>                 if (drv && drv->suspend) {
>                         err = drv->suspend(dev, msg);
>                         if (err)
> -                               scsi_device_resume(dev);
> +                               scsi_device_resume(to_scsi_device(dev));
>                 }
>         }
>         dev_dbg(dev, "scsi suspend: %d\n", err);
> 

  parent reply	other threads:[~2012-05-19  3:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-18 14:08 [patch] [SCSI] scsi_pm: passing wrong pointer to resume() Dan Carpenter
2012-05-18 14:08 ` Dan Carpenter
     [not found] ` <2FB252790F768E479D722B6F9B6D68C4B03E50@SCYBEXDAG02.amd.com>
2012-05-19  3:38   ` Aaron Lu [this message]
2012-05-19  3:38     ` Aaron Lu
2012-05-19  3:38     ` Aaron Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120519033821.GA2425@localhost.localdomain \
    --to=aaron.lu@amd.com \
    --cc=JBottomley@parallels.com \
    --cc=aaron.lwe@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.