]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
drivers: spmi: msm: fix return values for errors in parameters
authorLothar Waßmann <LW@KARO-electronics.de>
Mon, 13 Mar 2017 15:04:56 +0000 (16:04 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 14 Mar 2017 16:39:53 +0000 (17:39 +0100)
If an out-of-range usid or pid is passed to the
msm_spmi_{read|write}() functions, those currently return -EIO.
Since no actual I/O has taken place at this point, the error code is
misleading. Return the more appropriate -EINVAL in this case.

drivers/spmi/spmi-msm.c

index 48bc15759645835760ee7730e0e458372aae9201..41541875de71dad4325c10e3d24307170064b26e 100644 (file)
@@ -57,9 +57,9 @@ static int msm_spmi_write(struct udevice *dev, int usid, int pid, int off,
        uint32_t reg = 0;
 
        if (usid >= SPMI_MAX_SLAVES)
-               return -EIO;
+               return -EINVAL;
        if (pid >= SPMI_MAX_PERIPH)
-               return -EIO;
+               return -EINVAL;
 
        channel = priv->channel_map[usid][pid];
 
@@ -102,9 +102,9 @@ static int msm_spmi_read(struct udevice *dev, int usid, int pid, int off)
        uint32_t reg = 0;
 
        if (usid >= SPMI_MAX_SLAVES)
-               return -EIO;
+               return -EINVAL;
        if (pid >= SPMI_MAX_PERIPH)
-               return -EIO;
+               return -EINVAL;
 
        channel = priv->channel_map[usid][pid];