All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make checking the scsi_device_get() return value mandatory
@ 2017-04-05 16:52 Bart Van Assche
  2017-04-06  0:27 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Bart Van Assche @ 2017-04-05 16:52 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: Hannes Reinecke, Johannes Thumshirn, linux-scsi

Now that all scsi_device_get() callers check the return value of this
function, make checking that return value mandatory.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
---
 include/scsi/scsi_device.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index cdff28519393..7a154a944c6c 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -316,7 +316,7 @@ extern int scsi_unregister_device_handler(struct scsi_device_handler *scsi_dh);
 void scsi_attach_vpd(struct scsi_device *sdev);
 
 extern struct scsi_device *scsi_device_from_queue(struct request_queue *q);
-extern int scsi_device_get(struct scsi_device *);
+extern int __must_check scsi_device_get(struct scsi_device *);
 extern void scsi_device_put(struct scsi_device *);
 extern struct scsi_device *scsi_device_lookup(struct Scsi_Host *,
 					      uint, uint, u64);
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make checking the scsi_device_get() return value mandatory
  2017-04-05 16:52 [PATCH] Make checking the scsi_device_get() return value mandatory Bart Van Assche
@ 2017-04-06  0:27 ` kbuild test robot
  2017-04-06  0:30   ` Bart Van Assche
  2017-04-06  8:25 ` Johannes Thumshirn
  2017-04-06 16:46 ` Martin K. Petersen
  2 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2017-04-06  0:27 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: kbuild-all, Martin K. Petersen, Hannes Reinecke,
	Johannes Thumshirn, linux-scsi

[-- Attachment #1: Type: text/plain, Size: 3103 bytes --]

Hi Bart,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.11-rc5 next-20170405]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Bart-Van-Assche/Make-checking-the-scsi_device_get-return-value-mandatory/20170406-072137
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: x86_64-allyesdebian (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers//scsi/osd/osd_uld.c: In function 'osd_probe':
>> drivers//scsi/osd/osd_uld.c:467:2: warning: ignoring return value of 'scsi_device_get', declared with attribute warn_unused_result [-Wunused-result]
     scsi_device_get(scsi_device);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/scsi_device_get +467 drivers//scsi/osd/osd_uld.c

95b05a7db Boaz Harrosh 2009-01-25  451  
95b05a7db Boaz Harrosh 2009-01-25  452  	/* allocate a disk and set it up */
95b05a7db Boaz Harrosh 2009-01-25  453  	/* FIXME: do we need this since sg has already done that */
95b05a7db Boaz Harrosh 2009-01-25  454  	disk = alloc_disk(1);
95b05a7db Boaz Harrosh 2009-01-25  455  	if (!disk) {
95b05a7db Boaz Harrosh 2009-01-25  456  		OSD_ERR("alloc_disk failed\n");
95b05a7db Boaz Harrosh 2009-01-25  457  		goto err_free_osd;
95b05a7db Boaz Harrosh 2009-01-25  458  	}
95b05a7db Boaz Harrosh 2009-01-25  459  	disk->major = SCSI_OSD_MAJOR;
95b05a7db Boaz Harrosh 2009-01-25  460  	disk->first_minor = oud->minor;
95b05a7db Boaz Harrosh 2009-01-25  461  	sprintf(disk->disk_name, "osd%d", oud->minor);
95b05a7db Boaz Harrosh 2009-01-25  462  	oud->disk = disk;
95b05a7db Boaz Harrosh 2009-01-25  463  
95b05a7db Boaz Harrosh 2009-01-25  464  	/* hold one more reference to the scsi_device that will get released
95b05a7db Boaz Harrosh 2009-01-25  465  	 * in __release, in case a logout is happening while fs is mounted
95b05a7db Boaz Harrosh 2009-01-25  466  	 */
95b05a7db Boaz Harrosh 2009-01-25 @467  	scsi_device_get(scsi_device);
95b05a7db Boaz Harrosh 2009-01-25  468  	osd_dev_init(&oud->od, scsi_device);
95b05a7db Boaz Harrosh 2009-01-25  469  
95b05a7db Boaz Harrosh 2009-01-25  470  	/* Detect the OSD Version */
95b05a7db Boaz Harrosh 2009-01-25  471  	error = __detect_osd(oud);
95b05a7db Boaz Harrosh 2009-01-25  472  	if (error) {
95b05a7db Boaz Harrosh 2009-01-25  473  		OSD_ERR("osd detection failed, non-compatible OSD device\n");
95b05a7db Boaz Harrosh 2009-01-25  474  		goto err_put_disk;
95b05a7db Boaz Harrosh 2009-01-25  475  	}

:::::: The code at line 467 was first introduced by commit
:::::: 95b05a7db5865855c32e0bb8b244c3a7aac1cfeb [SCSI] osd_uld: OSD scsi ULD

:::::: TO: Boaz Harrosh <bharrosh@panasas.com>
:::::: CC: James Bottomley <James.Bottomley@HansenPartnership.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 38573 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make checking the scsi_device_get() return value mandatory
  2017-04-06  0:27 ` kbuild test robot
@ 2017-04-06  0:30   ` Bart Van Assche
  2017-04-06  8:25     ` Johannes Thumshirn
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2017-04-06  0:30 UTC (permalink / raw)
  Cc: linux-scsi, hare, jthumshirn, martin.petersen

On Thu, 2017-04-06 at 08:27 +0800, kbuild test robot wrote:
> All warnings (new ones prefixed by >>):
> 
>    drivers//scsi/osd/osd_uld.c: In function 'osd_probe':
> > > drivers//scsi/osd/osd_uld.c:467:2: warning: ignoring return value of 'scsi_device_get', declared with attribute warn_unused_result [-Wunused-result]
> 
>      scsi_device_get(scsi_device);
>      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please ignore this warning. It is triggered because patch "osd_uld: Check
scsi_device_get() return value" is not yet upstream.

Bart.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make checking the scsi_device_get() return value mandatory
  2017-04-06  0:30   ` Bart Van Assche
@ 2017-04-06  8:25     ` Johannes Thumshirn
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2017-04-06  8:25 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-scsi, hare, martin.petersen

On Thu, Apr 06, 2017 at 12:30:43AM +0000, Bart Van Assche wrote:
> On Thu, 2017-04-06 at 08:27 +0800, kbuild test robot wrote:
> > All warnings (new ones prefixed by >>):
> > 
> >    drivers//scsi/osd/osd_uld.c: In function 'osd_probe':
> > > > drivers//scsi/osd/osd_uld.c:467:2: warning: ignoring return value of 'scsi_device_get', declared with attribute warn_unused_result [-Wunused-result]
> > 
> >      scsi_device_get(scsi_device);
> >      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Please ignore this warning. It is triggered because patch "osd_uld: Check
> scsi_device_get() return value" is not yet upstream.

And verified this patch is valuable ;-)

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make checking the scsi_device_get() return value mandatory
  2017-04-05 16:52 [PATCH] Make checking the scsi_device_get() return value mandatory Bart Van Assche
  2017-04-06  0:27 ` kbuild test robot
@ 2017-04-06  8:25 ` Johannes Thumshirn
  2017-04-06 16:46 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Johannes Thumshirn @ 2017-04-06  8:25 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: Martin K. Petersen, Hannes Reinecke, linux-scsi

On Wed, Apr 05, 2017 at 09:52:50AM -0700, Bart Van Assche wrote:
> Now that all scsi_device_get() callers check the return value of this
> function, make checking that return value mandatory.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Hannes Reinecke <hare@suse.de>
> Cc: Johannes Thumshirn <jthumshirn@suse.de>
> ---

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Make checking the scsi_device_get() return value mandatory
  2017-04-05 16:52 [PATCH] Make checking the scsi_device_get() return value mandatory Bart Van Assche
  2017-04-06  0:27 ` kbuild test robot
  2017-04-06  8:25 ` Johannes Thumshirn
@ 2017-04-06 16:46 ` Martin K. Petersen
  2 siblings, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2017-04-06 16:46 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Martin K. Petersen, Hannes Reinecke, Johannes Thumshirn, linux-scsi

Bart Van Assche <bart.vanassche@sandisk.com> writes:

> Now that all scsi_device_get() callers check the return value of this
> function, make checking that return value mandatory.

Applied to 4.12/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-06 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 16:52 [PATCH] Make checking the scsi_device_get() return value mandatory Bart Van Assche
2017-04-06  0:27 ` kbuild test robot
2017-04-06  0:30   ` Bart Van Assche
2017-04-06  8:25     ` Johannes Thumshirn
2017-04-06  8:25 ` Johannes Thumshirn
2017-04-06 16:46 ` Martin K. Petersen

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.