Skip to contentSkip to conversation

bug fix for ata.c and scsi.c

PATCH In review Bean 2 participants 3 messages Sep 1, 2008 – Sep 22, 2008

lore
Share & tools
lore

Bean

author
#0 lore raw

PATCH 1/1 bug fix for ata.c and scsi.c

Hi,

2008-09-01 Bean <[email protected]>

* disk/ata.c (grub_apapi_open): Initialize devfnd, no need to set scsi->name and scsi->luns, as they will be set in grub_scsi_open.

* disk/scsi.c (grub_scsi_open): Don't call p->close (scsi) here when error occurs, as grub_disk_open will call grub_disk_close, which will call p->close (scsi).

Signature · 1 line
Bean
disk/ata.c +1 -3
index ab4a1da..214a2ca 100644
@@ -891,7 +891,7 @@ static grub_err_t
 grub_atapi_open (const char *name, struct grub_scsi *scsi)
 {
   struct grub_ata_device *dev;
-  struct grub_ata_device *devfnd;
+  struct grub_ata_device *devfnd = 0;
 
   for (dev = grub_ata_devices; dev; dev = dev->next)
     {
@@ -911,8 +911,6 @@ grub_atapi_open (const char *name, struct grub_scsi *scsi)
     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "No such ATAPI device");
 
   scsi->data = devfnd;
-  scsi->name = grub_strdup (name);
-  scsi->luns = 1;
 
   return GRUB_ERR_NONE;
 }
disk/scsi.c +0 -4
index 01ef04e..e822732 100644
@@ -255,7 +255,6 @@ grub_scsi_open (const char *name, grub_disk_t disk)
 	  scsi->name = grub_strdup (name);
 	  if (! scsi->name)
 	    {
-	      p->close (scsi);
 	      return grub_errno;
 	    }
 
@@ -265,7 +264,6 @@ grub_scsi_open (const char *name, grub_disk_t disk)
 	  if (err)
 	    {
 	      grub_dprintf ("scsi", "inquiry failed\n");
-	      p->close (scsi);
 	      return grub_errno;
 	    }
 
@@ -277,7 +275,6 @@ grub_scsi_open (const char *name, grub_disk_t disk)
 	  if (scsi->devtype != grub_scsi_devtype_direct
 	      && scsi->devtype != grub_scsi_devtype_cdrom)
 	    {
-	      p->close (scsi);
 	      return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
 				 "unknown SCSI device");
 	    }
@@ -291,7 +288,6 @@ grub_scsi_open (const char *name, grub_disk_t disk)
 	  if (err)
 	    {
 	      grub_dprintf ("scsi", "READ CAPACITY failed\n");
-	      p->close (scsi);
 	      return grub_errno;
 	    }
 
#1 lore raw
Quoted 10 lines · Bean

Hi,

2008-09-01 Bean <[email protected]>

* disk/ata.c (grub_apapi_open): Initialize devfnd, no need to set scsi->name and scsi->luns, as they will be set in grub_scsi_open.

* disk/scsi.c (grub_scsi_open): Don't call p->close (scsi) here when error occurs, as grub_disk_open will call grub_disk_close, which will call p->close (scsi).

I tested this and it seems to work fine. Will you check it in soon?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
author
#2 lore raw
Quoted 5 lines · Robert Millan
Quoted 4 lines · Bean

Hi,

2008-09-01 Bean <[email protected]>

Quoted 8 lines
Quoted 6 lines

* disk/ata.c (grub_apapi_open): Initialize devfnd, no need to set scsi->name and scsi->luns, as they will be set in grub_scsi_open.

* disk/scsi.c (grub_scsi_open): Don't call p->close (scsi) here when error occurs, as grub_disk_open will call grub_disk_close, which will call p->close (scsi).

I tested this and it seems to work fine. Will you check it in soon?

Hi,

Ok, committed.

Signature · 1 line
Bean