All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Brent Pappas <bpappas@pappasbrent.com>
Cc: andy.shevchenko@gmail.com, ailus@linux.intel.com,
	gregkh@linuxfoundation.org, hdegoede@redhat.com,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	linux-staging@lists.linux.dev, mchehab@kernel.org
Subject: Re: [PATCH v4] media: atomisp: pci: Replace bytes macros with functions
Date: Wed, 18 Jan 2023 17:56:24 +0300	[thread overview]
Message-ID: <Y8gImBdR6YpEKZEb@kadam> (raw)
In-Reply-To: <20230118144226.13127-1-bpappas@pappasbrent.com>

On Wed, Jan 18, 2023 at 09:42:26AM -0500, Brent Pappas wrote:
> Replace the function-like macros FPNTBL_BYTES(), SCTBL_BYTES(), and
> MORPH_PLANE_BYTES() with functions to comply with Linux coding style
> standards.
> Replace multiplication with calls to functions/macros from overflow.h
> to prevent accidental arithmetic overflow.
> 
> Signed-off-by: Brent Pappas <bpappas@pappasbrent.com>
> ---
> Changelog:
> V1 -> V2: Use size_mul() to perform size_t multiplication without risk of
> 		  overflow.
> 		  Remove the inline keyword from function definitions.
> 
> V2 -> V3: Add commit message.
> 
> V3 -> V4: Use array_size() and array3_size() for multiplication.
> 
>  .../staging/media/atomisp/pci/sh_css_params.c | 38 +++++++++++--------
>  1 file changed, 23 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/sh_css_params.c b/drivers/staging/media/atomisp/pci/sh_css_params.c
> index f08564f58242..7e111df5c09d 100644
> --- a/drivers/staging/media/atomisp/pci/sh_css_params.c
> +++ b/drivers/staging/media/atomisp/pci/sh_css_params.c
> @@ -98,17 +98,27 @@
>  #include "sh_css_frac.h"
>  #include "ia_css_bufq.h"
>  
> -#define FPNTBL_BYTES(binary) \
> -	(sizeof(char) * (binary)->in_frame_info.res.height * \
> -	 (binary)->in_frame_info.padded_width)
> +static size_t fpntbl_bytes(const struct ia_css_binary *binary)
> +{
> +	return array3_size(sizeof(char),
> +			binary->in_frame_info.res.height,
> +				 binary->in_frame_info.padded_width);

This indenting is not correct.  Do it the way that checkpatch.pl likes:

	return array3_size(sizeof(char),
			   binary->in_frame_info.res.height,
			   binary->in_frame_info.padded_width);

[tab][tab][tab][space][space][space]binary->in_frame_info.res.height,
[tab][tab][tab][space][space][space]binary->in_frame_info.padded_width);

(Same for the rest obviously)

regards,
dan carpenter



  reply	other threads:[~2023-01-18 14:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 15:08 [PATCH] staging: media: atomisp: pci: Replace bytes macros with functions Brent Pappas
2023-01-17 15:34 ` Andy Shevchenko
2023-01-17 15:35   ` Andy Shevchenko
2023-01-17 16:16     ` [PATCH v2] " Brent Pappas
2023-01-17 18:08       ` Andy Shevchenko
2023-01-17 18:31         ` [PATCH v3] " Brent Pappas
2023-01-17 18:37           ` Andy Shevchenko
2023-01-18 14:42             ` [PATCH v4] " Brent Pappas
2023-01-18 14:56               ` Dan Carpenter [this message]
2023-01-18 15:16                 ` [PATCH v5] " Brent Pappas
2023-01-18 15:26                   ` Dan Carpenter
2023-01-18 15:53                   ` Andy Shevchenko
2023-01-18 16:07                     ` [PATCH v6] " Brent Pappas
2023-01-18 16:17                       ` Andy Shevchenko
2023-01-18 17:41                         ` Brent Pappas
2023-01-23 12:27                       ` Hans de Goede

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=Y8gImBdR6YpEKZEb@kadam \
    --to=error27@gmail.com \
    --cc=ailus@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bpappas@pappasbrent.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.