Skip to content

Commit

Permalink
Merge branch 'for-4.13-fixes' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/tj/libata

Pull libata fixes from Tejun Heo:
 "Late fixes for libata. There's a minor platform driver fix but the
  important one is READ LOG PAGE.

  This is a new ATA command which is used to test some optional features
  but it broke probing of some devices - they locked up instead of
  failing the unknown command.

  Christoph tried blacklisting, but, after finding out there are
  multiple devices which fail this way, backed off to testing feature
  bit in IDENTIFY data first, which is a bit lossy (we can miss features
  on some devices) but should be a lot safer"

* 'for-4.13-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
  Revert "libata: quirk read log on no-name M.2 SSD"
  libata: check for trusted computing in IDENTIFY DEVICE data
  libata: quirk read log on no-name M.2 SSD
  sata: ahci-da850: Fix some error handling paths in 'ahci_da850_probe()'
  • Loading branch information
Linus Torvalds committed Aug 29, 2017
2 parents 785373b + 2aca392 commit 31a3faf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
8 changes: 6 additions & 2 deletions drivers/ata/ahci_da850.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,16 @@ static int ahci_da850_probe(struct platform_device *pdev)
return rc;

res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!res)
if (!res) {
rc = -ENODEV;
goto disable_resources;
}

pwrdn_reg = devm_ioremap(dev, res->start, resource_size(res));
if (!pwrdn_reg)
if (!pwrdn_reg) {
rc = -ENOMEM;
goto disable_resources;
}

da850_sata_init(dev, pwrdn_reg, hpriv->mmio, mpy);

Expand Down
3 changes: 3 additions & 0 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,9 @@ static void ata_dev_config_trusted(struct ata_device *dev)
u64 trusted_cap;
unsigned int err;

if (!ata_id_has_trusted(dev->id))
return;

if (!ata_identify_page_supported(dev, ATA_LOG_SECURITY)) {
ata_dev_warn(dev,
"Security Log not supported\n");
Expand Down
10 changes: 9 additions & 1 deletion include/linux/ata.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ enum {
ATA_ID_FW_REV = 23,
ATA_ID_PROD = 27,
ATA_ID_MAX_MULTSECT = 47,
ATA_ID_DWORD_IO = 48,
ATA_ID_DWORD_IO = 48, /* before ATA-8 */
ATA_ID_TRUSTED = 48, /* ATA-8 and later */
ATA_ID_CAPABILITY = 49,
ATA_ID_OLD_PIO_MODES = 51,
ATA_ID_OLD_DMA_MODES = 52,
Expand Down Expand Up @@ -889,6 +890,13 @@ static inline bool ata_id_has_dword_io(const u16 *id)
return id[ATA_ID_DWORD_IO] & (1 << 0);
}

static inline bool ata_id_has_trusted(const u16 *id)
{
if (ata_id_major_version(id) <= 7)
return false;
return id[ATA_ID_TRUSTED] & (1 << 0);
}

static inline bool ata_id_has_unload(const u16 *id)
{
if (ata_id_major_version(id) >= 7 &&
Expand Down

0 comments on commit 31a3faf

Please sign in to comment.