lkml.org 
[lkml]   [2018]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 2/2] i2c-puv3: Improve a size determination in puv3_i2c_probe()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Fri, 2 Feb 2018 15:43:21 +0100

    Replace the specification of a data structure by a pointer dereference
    as the parameter for the operator "sizeof" to make the corresponding size
    determination a bit safer according to the Linux coding style convention.

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/i2c/busses/i2c-puv3.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/i2c/busses/i2c-puv3.c b/drivers/i2c/busses/i2c-puv3.c
    index 5bd001d01bef..929fd12b92de 100644
    --- a/drivers/i2c/busses/i2c-puv3.c
    +++ b/drivers/i2c/busses/i2c-puv3.c
    @@ -196,7 +196,7 @@ static int puv3_i2c_probe(struct platform_device *pdev)
    if (!request_mem_region(mem->start, resource_size(mem), "puv3_i2c"))
    return -EBUSY;

    - adapter = kzalloc(sizeof(struct i2c_adapter), GFP_KERNEL);
    + adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
    if (adapter == NULL) {
    rc = -ENOMEM;
    goto fail_nomem;
    --
    2.16.1
    \
     
     \ /
      Last update: 2018-02-02 16:02    [W:5.509 / U:0.236 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site