`major-mode` is actually a symbol, so this would be better written as `(eq major-mode 'dired-mode)`.