aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/libata-core.c')
-rw-r--r--drivers/ata/libata-core.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 7d4b002568e..a03019c40ac 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3325,35 +3325,20 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3325 { } 3325 { }
3326}; 3326};
3327 3327
3328static int ata_strim(char *s, size_t len)
3329{
3330 len = strnlen(s, len);
3331
3332 /* ATAPI specifies that empty space is blank-filled; remove blanks */
3333 while ((len > 0) && (s[len - 1] == ' ')) {
3334 len--;
3335 s[len] = 0;
3336 }
3337 return len;
3338}
3339
3340unsigned long ata_device_blacklisted(const struct ata_device *dev) 3328unsigned long ata_device_blacklisted(const struct ata_device *dev)
3341{ 3329{
3342 unsigned char model_num[ATA_ID_PROD_LEN]; 3330 unsigned char model_num[ATA_ID_PROD_LEN + 1];
3343 unsigned char model_rev[ATA_ID_FW_REV_LEN]; 3331 unsigned char model_rev[ATA_ID_FW_REV_LEN + 1];
3344 unsigned int nlen, rlen;
3345 const struct ata_blacklist_entry *ad = ata_device_blacklist; 3332 const struct ata_blacklist_entry *ad = ata_device_blacklist;
3346 3333
3347 ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num)); 3334 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
3348 ata_id_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev)); 3335 ata_id_c_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
3349 nlen = ata_strim(model_num, sizeof(model_num));
3350 rlen = ata_strim(model_rev, sizeof(model_rev));
3351 3336
3352 while (ad->model_num) { 3337 while (ad->model_num) {
3353 if (!strncmp(ad->model_num, model_num, nlen)) { 3338 if (!strcmp(ad->model_num, model_num)) {
3354 if (ad->model_rev == NULL) 3339 if (ad->model_rev == NULL)
3355 return ad->horkage; 3340 return ad->horkage;
3356 if (!strncmp(ad->model_rev, model_rev, rlen)) 3341 if (!strcmp(ad->model_rev, model_rev))
3357 return ad->horkage; 3342 return ad->horkage;
3358 } 3343 }
3359 ad++; 3344 ad++;