Re: [PATCH v1 5/5] tinydrm: add winstar wg160160 driver

From: Sam Ravnborg
Date: Mon Aug 06 2018 - 08:07:19 EST


On Mon, Aug 06, 2018 at 12:15:48PM +0300, Dan Carpenter wrote:
> Hi Sam,
>
> I love your patch! Perhaps something to improve:
>
> url: https://github.com/0day-ci/linux/commits/Sam-Ravnborg/dt-bindings-add-parallel-data-bus-pardata/20180803-090135
>
> smatch warnings:
> drivers/gpu/drm/tinydrm/wg160160.c:145 write_buf() warn: right shifting more than type allows 8 vs 8
> include/drm/tinydrm/pardata-dbi.h:165 pardata_write_buf() error: we previously assumed 'pdd' could be null (see line 162)
>
> # https://github.com/0day-ci/linux/commit/9fcebca9e208029e06eea5e4858c1055132f06b6
> git remote add linux-review https://github.com/0day-ci/linux
> git remote update linux-review
> git checkout 9fcebca9e208029e06eea5e4858c1055132f06b6
> vim +145 drivers/gpu/drm/tinydrm/wg160160.c
>
> 9fcebca9 Sam Ravnborg 2018-08-02 124
> 9fcebca9 Sam Ravnborg 2018-08-02 125 /**
> 9fcebca9 Sam Ravnborg 2018-08-02 126 * write_buf - write buffer on parallel bus to controller
> 9fcebca9 Sam Ravnborg 2018-08-02 127 *
> 9fcebca9 Sam Ravnborg 2018-08-02 128 * @pdd: pardata data
> 9fcebca9 Sam Ravnborg 2018-08-02 129 * @offset: offset into display RAM
> 9fcebca9 Sam Ravnborg 2018-08-02 130 * @data: pointer to data to write
> 9fcebca9 Sam Ravnborg 2018-08-02 131 * @len: number of bytes to write
> 9fcebca9 Sam Ravnborg 2018-08-02 132 *
> 9fcebca9 Sam Ravnborg 2018-08-02 133 * Returns:
> 9fcebca9 Sam Ravnborg 2018-08-02 134 * Zero on success, negative error code on failure
> 9fcebca9 Sam Ravnborg 2018-08-02 135 */
> 9fcebca9 Sam Ravnborg 2018-08-02 136 int write_buf(struct pardata_data *pdd, u8 offset, u8 *data, size_t len)
> 9fcebca9 Sam Ravnborg 2018-08-02 137 {
> 9fcebca9 Sam Ravnborg 2018-08-02 138 int ins[PIN_NUM];
> 9fcebca9 Sam Ravnborg 2018-08-02 139 int val[PIN_NUM];
> 9fcebca9 Sam Ravnborg 2018-08-02 140 int bit;
> 9fcebca9 Sam Ravnborg 2018-08-02 141 int i;
> 9fcebca9 Sam Ravnborg 2018-08-02 142
> 9fcebca9 Sam Ravnborg 2018-08-02 143 /* Setup address */
> 9fcebca9 Sam Ravnborg 2018-08-02 144 write_reg(pdd, WG160160_ADDRSL_REG, offset & 0xff);
> 9fcebca9 Sam Ravnborg 2018-08-02 @145 write_reg(pdd, WG160160_ADDRSL_REG, (offset >> 8) & 0xff);
> ^^^^^^^^^^^^^^^^^^^^
> Probably this is fine. I don't know. If so then feel free to ignore
> the warning.

Thanks!
I will fix both issues in v2.

Sam