oemcommands: fix set and get drive info commands

- The parameter # of these commands are 0-based but the code treats
  a number smaller than 1 as an invalid input. The condition has to
  be removed for the command to be issued properly.

- The part that checks for the existence of oemData fields fails to
  compare the results on the same level.

- dimmInfoKey is micused for Get Drive Info command. Change it back
  to driveInfoKey.

Change-Id: I182257b8a7fd4f06a5aa3e66b05cc12fa2594c05
Signed-off-by: Bruce Hung <bruce.jy.hung@fii-foxconn.com>
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index a356ecb..e5cb0f5 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -1992,8 +1992,7 @@
     *data_len = 0;
 
     /* check for requested data params */
-    if (len < 6 || req->paramSel < 1 || req->paramSel >= numParam ||
-        ctrlType > 2)
+    if (len < 6 || req->paramSel >= numParam || ctrlType > 2)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "Invalid parameter received");
@@ -2052,7 +2051,7 @@
     *data_len = 0;
 
     /* check for requested data params */
-    if (req->paramSel < 1 || req->paramSel >= numParam || ctrlType > 2)
+    if (req->paramSel >= numParam || ctrlType > 2)
     {
         phosphor::logging::log<phosphor::logging::level::ERR>(
             "Invalid parameter received");
@@ -2067,16 +2066,16 @@
     ss << std::setw(2) << std::setfill('0') << (int)req->hddIndex;
 
     if (oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]].find(ss.str()) ==
-        oemData[KEY_Q_DRIVE_INFO].end())
+        oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]].end())
         return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
 
     if (oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()].find(
-            dimmInfoKey[req->paramSel]) ==
-        oemData[KEY_Q_DRIVE_INFO][ss.str()].end())
+            driveInfoKey[req->paramSel]) ==
+        oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()].end())
         return CC_PARAM_NOT_SUPP_IN_CURR_STATE;
 
     str = oemData[KEY_Q_DRIVE_INFO][ctrlTypeKey[ctrlType]][ss.str()]
-                 [dimmInfoKey[req->paramSel]];
+                 [driveInfoKey[req->paramSel]];
     *data_len = strToBytes(str, res);
 
     return ipmi::ccSuccess;