media: atomisp: Remove unnecessary NULL check in atomisp_param
authorNathan Chancellor <natechancellor@gmail.com>
Wed, 27 May 2020 07:11:48 +0000 (09:11 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 11 Jun 2020 16:17:13 +0000 (18:17 +0200)
Clang warns:

drivers/staging/media/atomisp/pci/atomisp_cmd.c:4278:17: warning:
address of 'config->info' will always evaluate to 'true'
[-Wpointer-bool-conversion]
                if (!&config->info) {
                    ~ ~~~~~~~~^~~~

config cannot be NULL because it comes from an ioctl, which ensures that
the user is not giving us an invalid pointer through copy_from_user. If
config is not NULL, info cannot be NULL. Remove this check.

Link: https://github.com/ClangBuiltLinux/linux/issues/1036
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_cmd.c

index 4913469df2bbd5ee74c259bf5e7d6a7d6baaddb9..5f34e7586ee4da1b20015b73e5e67d46624c9dd4 100644 (file)
@@ -4270,7 +4270,6 @@ apply_parameter_failed:
 int atomisp_param(struct atomisp_sub_device *asd, int flag,
                  struct atomisp_parm *config)
 {
-       struct atomisp_device *isp = asd->isp;
        struct ia_css_pipe_config *vp_cfg =
                    &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].
                    pipe_configs[IA_CSS_PIPE_ID_VIDEO];
@@ -4281,10 +4280,6 @@ int atomisp_param(struct atomisp_sub_device *asd, int flag,
                    atomisp_css_get_dvs_grid_info(
                        &asd->params.curr_grid_info);
 
-               if (!&config->info) {
-                       dev_err(isp->dev, "ERROR: NULL pointer in grid_info\n");
-                       return -EINVAL;
-               }
                atomisp_curr_user_grid_info(asd, &config->info);
 
                /* We always return the resolution and stride even if there is