[PATCH linux dev-4.7] drivers: fsi: scom: Fix return code for putscom

Joel Stanley joel at jms.id.au
Tue Feb 21 10:39:34 AEDT 2017


On Tue, Feb 21, 2017 at 7:47 AM, Eddie James <eajames at linux.vnet.ibm.com> wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
>
> Read/write calls should return the number of bytes read/written on
> success.
>
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
> ---
>  drivers/fsi/fsi-scom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
> index 2874ea0..51b3dc3 100644
> --- a/drivers/fsi/fsi-scom.c
> +++ b/drivers/fsi/fsi-scom.c
> @@ -156,7 +156,7 @@ static ssize_t scom_write(struct file *filep, const char __user *buf,
>         if (rc)
>                 dev_dbg(dev, "put_scom failed with:%d\n", rc);
>
> -       return rc;
> +       return rc ? rc : len;

I refactored this to be:

 if (rc) {
     dev_dbg(dev, "put_scom failed with:%d\n", rc);
     return rc;
 }

return len;

Are you ok with that?


>  }
>
>  static loff_t scom_llseek(struct file *file, loff_t offset, int whence)
> --
> 1.8.3.1
>


More information about the openbmc mailing list