Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: linux-media@vger.kernel.org
Subject: Re: [bug report] media: i2c: Copy mt9t112 soc_camera sensor driver
Date: Sat, 9 Oct 2021 11:28:48 +0300	[thread overview]
Message-ID: <20211009082848.GL2083@kadam> (raw)
In-Reply-To: <20211008154924.nwxf5t2qikcj7ecc@uno.localdomain>

On Fri, Oct 08, 2021 at 05:49:24PM +0200, Jacopo Mondi wrote:
> >     166         msg[1].buf   = buf;
> >     167
> >     168         /*
> >     169          * If return value of this function is < 0, it means error, else,
> >     170          * below 16bit is valid data.
> >     171          */
> >     172         ret = i2c_transfer(client->adapter, msg, 2);
> >     173         if (ret < 0)
> >     174                 return ret;
> >     175
> > --> 176         memcpy(&ret, buf, 2);
> >                        ^^^^
> > And this is ugly as all heck.  I would have fixed it but there were
> > so many other endian bugs and I can't test it.
> 
> Is this an endianess issue or just a complaint about the difference in
> size between the number of copied bytes and the destination ?

On big endian systems this would translate the value from buf into a
very large value but on little endian systems it should work okay.
(I think).  But all the swap16 stuff are endian bugs as well.

regards,
dan carpenter

> 
> Thanks
>    j
> 
> >
> >     177
> >     178         return swab16(ret);
> >     179 }
> >
> > regards,
> > dan carpenter

      reply	other threads:[~2021-10-09  8:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05  9:25 [bug report] media: i2c: Copy mt9t112 soc_camera sensor driver Dan Carpenter
2021-10-08 15:49 ` Jacopo Mondi
2021-10-09  8:28   ` Dan Carpenter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211009082848.GL2083@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=jacopo@jmondi.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox